Pipo Pipo - 3 months ago 18
Ajax Question

Javascript equivalent of jquery ajaxStop

I have multiple ajax request launched at the same time and I want to be able to call a function when they end.

I saw the jQuery function :

ajaxStop()
but I can't use jQuery in my project.

Does anyone know how to do the same in javascript only?

Thanks for help !

Answer

You can use the abort method to stop an http call.

//kill the request
xhr.abort()

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/abort