diff --git a/readme.md b/readme.md index 1a8ab42..436a92f 100644 --- a/readme.md +++ b/readme.md @@ -15,19 +15,35 @@ Ajax lookup: $('#autocomplete').autocomplete({ serviceUrl: '/autocomplete/countries', onSelect: function (suggestion) { - status.html('You selected: ' + suggestion); + alert('You selected: ' + suggestion.value + ', ' + suggestion.data); } }); Local lookup (no ajax): + var countries = [ + { value: 'Andorra', data: 'AD' }, + // ... + { value: 'Zimbabwe', data: 'ZZ' } + ]; + $('#autocomplete').autocomplete({ lookup: countries, onSelect: function (suggestion) { - status.html('You selected: ' + suggestion); + alert('You selected: ' + suggestion.value + ', ' + suggestion.data); } }); +##Styling + +Generated HTML markup for suggestions is displayed bellow. You may style it any way you'd like. + +
+
...
+
...
+
...
+
+ ##Response Format Response from the server must be JSON formatted following JavaScript object: