Bypass all cacheing on jQuery.autocomplete(1.02)

Posted by technicalbloke on Stack Overflow See other posts from Stack Overflow or by technicalbloke
Published on 2009-04-15T07:37:11Z Indexed on 2010/03/19 1:01 UTC
Read the original article Hit count: 527

I am using jQuery.autocomplete(1.02) on my search box and I want exact string and substring matching. I don't care (yet!) about the database load, I'm happy for it to fire off a query every keystroke and bypass the caching entirely - I just don't want anything missed.

To this end I have tried setting cacheLength=1, the minimum permitted, but the autocomplete function refuses to fire off a GET request for each key up.

searchbox          GET_request

   'a'       ->    http://localhost/service_search_request?q=a
   'ar'      ->    http://localhost/service_search_request?q=ar
   'ars'     ->    http://localhost/service_search_request?q=ars

Instead, it sends the first and the third and misses the second, giving me the wrong results for 'ar' :-/ I've cleared my cache and sessions but it looks like some sort of caching is still going on. AFAIK I have no proxying going on and I'm shift-refreshing each time. It looks likely then that this behavior is from jQuery.autocomplete itself.

So my questions are...

A) Does this seem likely? i.e. is it a feature, or maybe a bug?

B) If so is there a clean way around it?...

C) If not, what autocomplete would you use instead?

Naturally D) No you're just using it incorrectly you douche! is always a possibility, and indeed the one I'd prefer having spent time going down this road - assuming it comes with a link to the docs I've failed to find / read!

Cheers,

Roger :)

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about autocomplete