Javascript timer that restarts on key up?

Posted by Haroldo on Stack Overflow See other posts from Stack Overflow or by Haroldo
Published on 2010-03-22T12:16:51Z Indexed on 2010/03/22 12:21 UTC
Read the original article Hit count: 323

Filed under:
|
|

O, so i have a 'live search' ajax search, which currently runs an sql search (via ajax) on each key up.

What i would prefer is to:

run an sql search after a key has not been pressed for say 800 milliseconds

.

So i want to have a timer that is started on key up, if the timer reaches 800ms then the ajax is called, if a new keyup event occurs the timer is restarted

how would i do this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX