]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Update remote-jsonp demo with working geo webservice
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 29 Jan 2014 14:12:59 +0000 (15:12 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 29 Jan 2014 14:16:07 +0000 (15:16 +0100)
The previous webservice now requires user credentials. The new one is also
in use in a jQuery Mobile demo.

Fixes #9764

(cherry picked from commit d4865dcbcdccdce59f07b324f230a1f1991aa39d)

demos/autocomplete/remote-jsonp.html

index a2b4cc4e9c796780fe7855cdb75df6323de03c2a..7fb75d1b1955ca256d46d9432dee842945e8a2ca 100644 (file)
                $( "#city" ).autocomplete({
                        source: function( request, response ) {
                                $.ajax({
-                                       url: "http://ws.geonames.org/searchJSON",
+                                       url: "http://gd.geobytes.com/AutoCompleteCity",
                                        dataType: "jsonp",
                                        data: {
-                                               featureClass: "P",
-                                               style: "full",
-                                               maxRows: 12,
-                                               name_startsWith: request.term
+                                               q: request.term
                                        },
                                        success: function( data ) {
-                                               response( $.map( data.geonames, function( item ) {
-                                                       return {
-                                                               label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
-                                                               value: item.name
-                                                       }
-                                               }));
+                                               response( data );
                                        }
                                });
                        },