i am making a ajax request using $.get as soon as the user types a character in the input box i want to abort the previous ajax calls and then make the new one, is there a way?
edit
solved!
i just found out that $.get is a shorthand way to $.ajax and hence it returns a XHR and so we can call abort on that variable.
You can use
.abort()
on XMLHttpRequest that$.get
returns.From jQuery.ajax() documentation:
More on
.abort()
: XMLHttpRequest.abort()There is also jQuery plugin AjaxQueue for handling multiple Ajax request made in parallel.