I have a search field on my web application, and that search field is used to search an external datasource through an API . I pass my query (the textbox value) and get back the XML results. Simple.
However, wanting to add that extra bit of sexiness , I want to have the results returned in realtime, as the user is typing (as opposed to having to type the whole search query, and then press a ‘Search’ button).
Now, I realize that I can hook into the keyDown/keyUp events of the textbox, BUT that introduces a new problem. The external API I ’m referencing doesn’t allow you to make more than one call per second (obviously to reduce server load, which I understand).
SO basically, I was wondering if anybody knows of a way to detect when the user has FINISHED entering their search term. Basically, what I want to do is detect a specified pause in text entry. So for example, after no text has been added/changed in the textbox for at least 3 seconds, we’ll assume the user has typed what they want to type, and then proceed to process that text (in this case, send it to the API for our results).
Anybody have any ideas?
I think I know what you can try, but give me like ~10-15 minutes to finish this essay, and then I’ll try and see if what I was thinking would work.
(OT: Just noticed we have the same badges. :P)