jQuery autosuggest example

Posted by RUtt on Stack Overflow See other posts from Stack Overflow or by RUtt
Published on 2010-05-25T23:22:44Z Indexed on 2010/05/25 23:31 UTC
Read the original article Hit count: 215

Filed under:
|

I need to implement an "autosuggest" feature on our site but it needs to re-query the on every keystroke after a certain number of keys (like every character after 2 it would need to query again). So the result isn't a limiting search. For example, the autocomplete plugins I've seen work like the following:

[looking for a county] 1. customer types 'CA' and the first result would return 'Canada', 'Cambodia', and 'Camaroon' 2. customer continues to type and hits 'M' the new results would query within the only the existing 3 results (producing results of just 'Cambodia' and 'Camaroon')

I need a solution that would be the equivalent of querying my datasource on each keystroke. I already have the ajax call that will return my results based on the "typed" params. For example (in the above example), it would need to make an ajax call passing 'ca' first and if the customer kept typing passing 'can' on the 3 character and so forth.

Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-plugins