Very interesting idea. So, if I understand you correctly, an AJAX
request is only made if a person stops typing for 300 milliseconds?

It's not the perfect solution since receiving results is now delayed
an extra 300ms. And there's still a chance for choppy results if a
person is on a very bad internet connection and types new letters
every 301ms. But it's light years ahead of my current algorithm,
thanks!

Unless someone else chimes in it looks like I'll be implementing it
this way.

BT

On Jul 17, 1:16 am, Strija <[EMAIL PROTECTED]> wrote:
> On Jul 16, 11:15 pm, batobin <[EMAIL PROTECTED]> wrote:
>
> > Hello everyone. This is a general question about stopping (or
> > overriding) an AJAX call once it has been made. In order to illustrate
> > my question I can give a specific example, but I'm sure this topic is
> > applicable to many people besides myself...
>
> I have done something similar, but i used setTimeout. So a request is
> not made everytime when someone is typing.
> Actually it's quite simple. The function refres_list() diplays the
> results. Hope it helps.
> My code looks like this:
>
> var search_timeout = false;
> $("#quick-search").keypress(function() {
>         clearTimeout( search_timeout );
>         search_timeout = setTimeout(function() {
>                 refresh_list();
>         }, 300);
>
> });

Reply via email to