2011-04-08 58 views
1

如何保存在文本框中輸入內容後顯示的自動完成值? 見here (類型2440在下面的文本框裏爲例)如何自動保存自動完成值?

它說我需要輸入郵政編碼,看看他們接受自動填充值「郊區,州,郵編」格式「由郊區搜索」 (否則不起作用)。 所以我想自動發送一堆郵編,並保存顯示該特定郵編的'自動完成值'(或'建議值')。

我以爲我可以用Firebug控制檯的javascript做到這一點,以誘使網站認爲它是用戶輸入郵編並保存返回數據而不是像建議一樣顯示它。但我不能走得太遠。

您認爲如何?

順便說一句在這裏沒有什麼非法或不道德的。

回答

0

如果您有螢火蟲,那麼您只需查看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

+0

感謝herostwist,但我無法找到你這樣做是從哪裏。我在哪裏可以看到ajax請求以及響應選項卡在哪裏? (我使用Firefox 3.6.16最新的Firebug)。我如何自動化這個更多的郵編? – Bob 2011-04-08 15:10:13

+0

在控制檯選項卡中確保您已經檢查了showxmlhttprequests,並且您在使用aoutocompleter後應該會看到http://www.myschool.edu.au/AutoComplete.asmx/GetSuburbNames的請求。 – herostwist 2011-04-08 15:17:25

+0

如果您想查看如何提取位置的示例,請參閱此處:http://jsfiddle.net/NYguK/ – herostwist 2011-04-08 15:19:56