Thanks,

What I ended up doing was grabbing the current time before I make the
AJAX call, and then storing it in a "latest_keypress_time" data
variable in the textbox jQuery object.  Then, in the callback, compare
the keypress_time from before the AJAX call to the
"latest_keypress_time" data variable, to see if the one we're
processing is the latest one.

   $("#my_textbox").keyup(function()   {
      var textbox = this;
      var keypress_time = new Date();
      $(textbox).data("latest_keypress_time", keypress_time);
      // other code...
      $.get("ajax_script.php", data, function(response)  {
         if (keypress_time < $(textbox).data("latest_keypress_time"))
{
            return;
         }     // end if (keypress_time , $
(textbox).data("latest_keypress_time"))
         // other callback code
      });   // end $.get()
   });   // end $("#my_textbox").keyup()

Works *fairly* well - as long as you don't type faster than one
keypress per millisecond. :)

Jamie

On Apr 21, 5:18 pm, Donald J Organ IV <[EMAIL PROTECTED]> wrote:
> You would need something to keep track of the time between keyDown events 
> then just pick the amount of time you want to trigger on.
> livefree75 wrote:Hi, I have an AJAX GET going out on KeyUp on a text box. I 
> want to Cancel the request or ignore the response if a new AJAX request has 
> gone out since the first one began. In other words, I only want to process 
> the AJAX request when the user is "done" entering. a la GMail address lookup. 
> What's the best way to do this? Jamie

Reply via email to