something along the lines of this: var interval; $("#searchField").keyup(function(){ clearInterval(interval); interval = setInterval($.post(), '200'); });
On Apr 24, 1:46 pm, Dragon-Fly999 <dragon-fly...@hotmail.com> wrote: > Hi, my page allows the user to enter a number in a text box and a > search request is sent to the server (if the user stops typing for 200 > ms) using AJAX. The following is the desired behavior. > > (1) User starts typing a number in the text box. As the user is > typing, no search requests are sent to the server. > (2) Once the user stops typing (i.e. no key events for 200 ms), use > $.post() to execute a search. > > What is a good way to detect that the user hasn't typed anything for > 200 ms? Is there anything in JQuery that I can use? Thank you.