Reputation: 1077
$( "#tags" ).autocomplete({
source: availableTags
});
In the above code for the jquery autocomplete, instead of availableTags, I need to set the source to all the names in a particular table, without giving the query(if possible) instead. Is there any way to do this ?
There are millions of records so putting it into an array or list is not possible. I'm thinking of caching the data from db and then reading from the cache. Can I do that, or is there any other method ?
Upvotes: 0
Views: 722
Reputation: 14863
The autocomplete has built in support for remote datasource, look at this: http://jqueryui.com/demos/autocomplete/#remote
You point your js to a php-script, sending the search-query in get. If you want to build a cache-system you can do this in your file. It depends on your database, if it's huge and the search takes a long time, this is necessary, if not, I would simply do a complete search every time the script runs.
Upvotes: 1