mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-22 12:55:12 +00:00
Update lookup sample code, closes #329
This commit is contained in:
parent
5f7f91af0b
commit
82abff9f3c
14
readme.md
14
readme.md
@ -123,13 +123,15 @@ $('#autocomplete').autocomplete({
|
|||||||
lookup: function (query, done) {
|
lookup: function (query, done) {
|
||||||
// Do ajax call or lookup locally, when done,
|
// Do ajax call or lookup locally, when done,
|
||||||
// call the callback and pass your results:
|
// call the callback and pass your results:
|
||||||
var results = [
|
var result = {
|
||||||
{ "value": "United Arab Emirates", "data": "AE" },
|
suggestions: [
|
||||||
{ "value": "United Kingdom", "data": "UK" },
|
{ "value": "United Arab Emirates", "data": "AE" },
|
||||||
{ "value": "United States", "data": "US" }
|
{ "value": "United Kingdom", "data": "UK" },
|
||||||
];
|
{ "value": "United States", "data": "US" }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
done(results);
|
done(result);
|
||||||
},
|
},
|
||||||
onSelect: function (suggestion) {
|
onSelect: function (suggestion) {
|
||||||
alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
|
alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
|
||||||
|
Loading…
Reference in New Issue
Block a user