I know this question is asked more often here on Stack, but I don't seem to get a working answer out of all the questions asked.
The question "How to abort an AJAX call?" is mostly answered with the following solution (I use jQuery):
var call = $.ajax({
url: 'path/to/destination',
type: 'GET',
dataType: 'json'
})
.done(function() {
console.log("Done!");
})
.fail(function() {
console.log("Error!");
})
To abort the call just do: call.abort();
But that doesn't seem to work. (While it should, right?!).
When I trigger the abort()
function, it gives back an object, but my request is still pending in the network tab of dev tools. Once the server is done processing my request it gives it back regardless of the abort()
function.
According to my research, it can't be stopped that way, because the request is already sent and received by the server and therefore can't be aborted. But shouldn't there be a way to stop waiting on the server and disregard the info it would give back or just cut the connection of the AJAX call in question?