Cancelling an already running query

Discussion created by Sal_Joensen on Feb 22, 2012
Latest reply on Mar 30, 2012 by scorpion26
I have an application that queries the mapserver as you type in a text box.

Is there a way to cancel a query? The situation is that a user might type in the text box; the first letter sends a query for that one letter, but then the user types a second letter, such that there are 2 queries running simultaneously, and the 2nd query comes back before the 1st query. E.g. a user types "r", which takes a while for the server to return the results for, but before that happens the user has subsequently typed "re", a shorter query which comes back before the first one.

I want to cancel any running query as soon as a letter is typed, maybe have an IF condition for checking if a query is already running, or some other similar solution.