Created
July 17, 2014 14:20
-
-
Save karneds/262418c8e8647e035c25 to your computer and use it in GitHub Desktop.
Jquery autocomplete from yandex maps api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('#address').autocomplete({ | |
| source: function( request, response ) { | |
| $.getJSON("http://geocode-maps.yandex.ru/1.x/?",{ | |
| format: "json", | |
| geocode:request.term | |
| }).done(function( data ) { | |
| var addresses = []; | |
| $.each(data.response.GeoObjectCollection.featureMember, function(i,item) { | |
| addresses.push(item.GeoObject.name); | |
| //addresses.push(item.GeoObject.metaDataProperty.GeocoderMetaData.text); full address | |
| }); | |
| response(addresses); | |
| }); | |
| }, | |
| minLength: 3 | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment