0
$( "#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 ?

1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

What exactly do i write in the php file ? That is not mentioned on the site.
Well, forgetting caching, you do a query, where you match your database with FIELDNAME LIKE '%QUERYGOESHERE%'
Do you have any link where they explain what to write in php file as well ?
Kind of depends how your database is built. This is my script, I am using a cms called modx. pastebin.com/3gsZYxXY . If you have basic knowledge in php and mysql, this should not be very difficult.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.