Skip to content

Instantly share code, notes, and snippets.

@araslanov-e
Created September 5, 2013 03:17
Show Gist options
  • Save araslanov-e/6445658 to your computer and use it in GitHub Desktop.
Save araslanov-e/6445658 to your computer and use it in GitHub Desktop.
Сервис КЛАДР (http://kladr-api.ru/) совместно с Select2 (http://ivaynberg.github.io/select2/)
$("#street").select2
minimumInputLength: 1
ajax:
url: 'http://kladr-api.ru/api.php'
dataType: 'jsonp'
data: (term, page) ->
token: 'token'
key: 'key'
cityId: 'cityId'
query: term
contentType: 'street'
limit: 10
results: (data, page) ->
{results: data.result}
formatResult: (item) ->
item.name
formatSelection: (item) ->
item.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment