views:

30

answers:

1

Hello all

I am using the deprecated autocomplete plugin (since I'm using the legacy jquery lib 1.3.2).

My problem is that the autocomplete plugin tries to cache the requests. I am using a server side url to return the results.

Consider this scenario:

Keyword : Results
i : ikea, iphone, ipod, ipad, iphone 4
ip: iphone, ipod, ipad, iphone4
iph: iphone, iphone 4
ipho: iphone, iphone 4

...

You see the problem, the first time it got 5 results - that's the limit I have set at backend, its returning 5 results only. The next time, it doesn't send a request, it refines the resultset it got in first request and so on.

How can I make the autocomplete plugin send a request everytime the input changes?

Here is my code...

$("#query").autocomplete(
    "/getSuggestions/", {
        autoFill: true,
        selectFirst: false,
        cacheLength: 1
    });

I tried setting the cacheLength to "1", but that doesn't work.

Can somebody help me out over here?

A: 
$("#query").autocomplete(
    "/getSuggestions/", {
        autoFill: true,
        selectFirst: false,
        cacheLength: 0
    });

It turned out to be quite a simple solution - setting the cacheLength to 0 does the trick.

I was referring the explanation in documentation till now...

The number of backend query results to store in cache. If set to 1 (the current result), no caching will happen. Must be >= 1.

Anyway I got the desired solution.

ShiVik