When using ajax to request a page or data, there will be occasions where you will need to cancel the ajax call.
Some reasons may be that the page you are calling enters an infinite loop and stops the call from returning. Maybe you need to cancel a previous request before making a new request to prevent duplicate requests from being sent.
Luckily jQuery has made this almost too easy as you can see by my example below.
Now you can call the goAjax() function as often as you like and it will cancel the previous ajax request if it hasn’t been completed before making a new request preventing duplicate requests from occuring.