Reputation: 13213
If i have a source for the .autocomplete()
that is JSON, and like this:
[{
value: "jquery",
label: "jQuery",
desc: "the write less, do more, JavaScript library",
icon: "jquery_32x32.png"
}]
No matter what i type into the input it still shows ALL of the JSON results. I thought .autocomplete()
would process the searching client side rather than expect the server to process it, maybe i'm wrong, because when you define an array as an object for the source
it handles the client side searching for you, but how would i get it to act the same way from a JSON data source?
The code is here:
$.getJSON(url, function(data) {
//autocomplete
$( "#name" ).autocomplete({
source: data,
minLength: 2
})
});
Upvotes: 0
Views: 3050
Reputation: 16446
Take a look at this, jquery autocomplete with json response
It may help you.
Also, the autocomplete expects the data to be an array.
Upvotes: 1