如何自动保存自动完成值?

时间:2011-04-08 14:29:35

标签: javascript ajax data-mining

如何保存在文本框中输入内容后显示的自动填充值? 见here (在下部文本框中输入2440作为示例)

如果说“郊区搜索”,我需要输入一个邮政编码,以查看他们接受的“郊区,州,邮政编码”格式作为自动填充值(否则无效)。 所以我想自动发送一堆邮政编码并保存显示该特定邮政编码的“自动完成值”(或“建议值”)。

我以为我可以使用来自Firebug控制台的javascript来欺骗网站,让他们认为用户输入邮政编码并保存返回数据而不是像建议那样显示。但我不能走得太远。

您怎么看?

顺便说一下,这里没有任何违法或不道德的行为。

1 个答案:

答案 0 :(得分:0)

如果你有firebug,那么你可以简单地查看ajax请求并从响应选项卡中复制json。

这是2440返回的内容

> {
>     "d": [
>         "{\"First\":\"Aldavilla,NSW,2440\",\"Second\":\"Aldavilla,NSW,2440\"}",
>         "{\"First\":\"Alstonville,NSW,2477\",\"Second\":\"Alstonville,NSW,2477\"}",
>         "{\"First\":\"Ballina,NSW,2478\",\"Second\":\"Ballina,NSW,2478\"}",
>         "{\"First\":\"Ballina East,NSW,2478\",\"Second\":\"Ballina
> East,NSW,2478\"}",
>         "{\"First\":\"Bangalow,NSW,2479\",\"Second\":\"Bangalow,NSW,2479\"}",
>         "{\"First\":\"Banora Point,NSW,2486\",\"Second\":\"Banora
> Point,NSW,2486\"}",
>         "{\"First\":\"Barrington,NSW,2422\",\"Second\":\"Barrington,NSW,2422\"}",
>         "{\"First\":\"Baryulgil,NSW,2460\",\"Second\":\"Baryulgil,NSW,2460\"}",
>         "{\"First\":\"Bayldon,NSW,2452\",\"Second\":\"Bayldon,NSW,2452\"}",
>         "{\"First\":\"Bellbrook,NSW,2440\",\"Second\":\"Bellbrook,NSW,2440\"}",
>         "{\"First\":\"Bellingen,NSW,2454\",\"Second\":\"Bellingen,NSW,2454\"}",
>         "{\"First\":\"Bentley,NSW,2480\",\"Second\":\"Bentley,NSW,2480\"}",
>         "{\"First\":\"Bexhill,NSW,2480\",\"Second\":\"Bexhill,NSW,2480\"}",
>         "{\"First\":\"Bilambil,NSW,2486\",\"Second\":\"Bilambil,NSW,2486\"}",
>         "{\"First\":\"Bingara,NSW,2404\",\"Second\":\"Bingara,NSW,2404\"}",
>         "{\"First\":\"Blakebrook,NSW,2480\",\"Second\":\"Blakebrook,NSW,2480\"}",
>         "{\"First\":\"Boambee,NSW,2450\",\"Second\":\"Boambee,NSW,2450\"}",
>         "{\"First\":\"Bobin,NSW,2429\",\"Second\":\"Bobin,NSW,2429\"}",
>         "{\"First\":\"Bogangar,NSW,2488\",\"Second\":\"Bogangar,NSW,2488\"}",
>         "{\"First\":\"Boggabilla,NSW,2409\",\"Second\":\"Boggabilla,NSW,2409\"}",
>         "{\"First\":\"Bonalbo,NSW,2469\",\"Second\":\"Bonalbo,NSW,2469\"}",
>         "{\"First\":\"Bonville,NSW,2441\",\"Second\":\"Bonville,NSW,2441\"}",
>         "{\"First\":\"Boomerang Beach,NSW,2428\",\"Second\":\"Boomerang
> Beach,NSW,2428\"}",
>         "{\"First\":\"Boomi,NSW,2405\",\"Second\":\"Boomi,NSW,2405\"}",
>         "{\"First\":\"Booral,NSW,2425\",\"Second\":\"Booral,NSW,2425\"}",
>         "{\"First\":\"Bowraville,NSW,2449\",\"Second\":\"Bowraville,NSW,2449\"}",
>         "{\"First\":\"Broadwater,NSW,2472\",\"Second\":\"Broadwater,NSW,2472\"}",
>         "{\"First\":\"Brunswick Heads,NSW,2483\",\"Second\":\"Brunswick
> Heads,NSW,2483\"}",
>         "{\"First\":\"Bulahdelah,NSW,2423\",\"Second\":\"Bulahdelah,NSW,2423\"}",
>         "{\"First\":\"Bungwahl,NSW,2423\",\"Second\":\"Bungwahl,NSW,2423\"}",
>         "{\"First\":\"Burringbar,NSW,2483\",\"Second\":\"Burringbar,NSW,2483\"}",
>         "{\"First\":\"Byabarra,NSW,2446\",\"Second\":\"Byabarra,NSW,2446\"}",
>         "{\"First\":\"Byron Bay,NSW,2481\",\"Second\":\"Byron
> Bay,NSW,2481\"}",
>         "{\"First\":\"Cabbage Tree Island,NSW,2477\",\"Second\":\"Cabbage
> Tree Island,NSW,2477\"}",
>         "{\"First\":\"Carool,NSW,2486\",\"Second\":\"Carool,NSW,2486\"}",
>         "{\"First\":\"Cascade,NSW,2453\",\"Second\":\"Cascade,NSW,2453\"}",
>         "{\"First\":\"Casino,NSW,2470\",\"Second\":\"Casino,NSW,2470\"}",
>         "{\"First\":\"Chatsworth Island,NSW,2469\",\"Second\":\"Chatsworth
> Island,NSW,2469\"}",
>         "{\"First\":\"Chillingham,NSW,2484\",\"Second\":\"Chillingham,NSW,2484\"}",
>         "{\"First\":\"Clarenza Via Grafton,NSW,2460\",\"Second\":\"Clarenza
> Via Grafton,NSW,2460\"}",
>         "{\"First\":\"Clunes,NSW,2480\",\"Second\":\"Clunes,NSW,2480\"}",
>         "{\"First\":\"Coffee Camp,NSW,2480\",\"Second\":\"Coffee
> Camp,NSW,2480\"}",
>         "{\"First\":\"Coffs Harbour,NSW,2450\",\"Second\":\"Coffs
> Harbour,NSW,2450\"}",
>         "{\"First\":\"Coffs Harbour Jetty,NSW,2450\",\"Second\":\"Coffs
> Harbour Jetty,NSW,2450\"}",
>         "{\"First\":\"Collins Creek,NSW,2474\",\"Second\":\"Collins
> Creek,NSW,2474\"}",
>         "{\"First\":\"Comboyne,NSW,2429\",\"Second\":\"Comboyne,NSW,2429\"}",
>         "{\"First\":\"Condong,NSW,2484\",\"Second\":\"Condong,NSW,2484\"}",
>         "{\"First\":\"Coolongolook,NSW,2423\",\"Second\":\"Coolongolook,NSW,2423\"}",
>         "{\"First\":\"Coopernook,NSW,2426\",\"Second\":\"Coopernook,NSW,2426\"}",
>         "{\"First\":\"Coorabell,NSW,2479\",\"Second\":\"Coorabell,NSW,2479\"}"
>     ] }

enter image description here