i have problem with using jquery-ui auto-complete for json. say, my json query return from myurl/users/listid and this is the returning data:
[{"label":"test@gmail.com"},{"label":"omg@hotmail.com"},{"label":"bad@yahoo.com"}]
and this is my jquery script for autocomplete.
$("#search-query").autocomplete({
source: '/users/listid'
});
when i type something into my #search-query input box, this all three email id are shown regardless what i type. it should narrow it down to what it matches to the character i try to type. but it doesn’t.
okay. this is something wierd. when i change something like following script, everything works perfect.
var data = [{"label":"test@gmail.com"},{"label":"omg@hotmail.com"},{"label":"bad@yahoo.com"}];
$("#search-query").autocomplete({
source: data
});
i have totally no idea what has gone wrong. please guide me. thanks.
If the source is an
url,autocompleteexpect your own business logic in thaturlto filter out the options. The paramatertermwould be sent to the url with the input value.