Hi guys, I have a search textbox where upon keppress an ajax call is made to return search results for the inputted text. The thing is that this results in an Ajax call being made for like every single keypress - so if I wish to type in lets say airport
I get 7 ajax requests each searching for a, ai, air, airp, airpo, airpor, airport respectively - however the problem is that they might all start one after the other but don't necessarily end in the same order so more often than not I recieve results in wrong order i.e I might have written airport and recieved the result for airport only to recieve the result for airpo later on...
How do I handle this in JQuery here?
============================== EDIT
There is a timer delay of 3 seconds - but the issue is in ensuring that when one Ajax request is made, another Request when made cancels out the previous request and so forth.. how could I do it in code?