Skip to content
Advertisement

Abort new AJAX request before completing the previous one

I have a function that runs an AJAX call on the change of an input.

But, there is a chance that the function will be fired again before the previous ajax call has completed.

My question is, how would I abort the previous AJAX call before starting a new one? Without using a global variable. (See answer to a similar question here)

JSFiddle of my current code:

Javascript:

JavaScript

HTML:

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement