Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.

.ajaxStop(function())🡢 jQuery

function() FunctionThe function to be invoked.

Whenever an Ajax request completes, jQuery checks whether there are any other outstanding Ajax requests. If none remain, jQuery triggers the ajaxStop event. Any and all handlers that have been registered with the .ajaxStop() method are executed at this time. The ajaxStop event is also triggered if the last outstanding Ajax request is cancelled by returning false within the beforeSend callback function.

To observe this method in action, set up a basic Ajax load request:

<div class="trigger">Trigger</div>
<div class="result"></div>
<div class="log"></div>

Attach the event handler to the document:

$(document).ajaxStop(function () {
  $(".log").text("Triggered ajaxStop handler.");

Now, make an Ajax request using any jQuery method:

$(".trigger").click(function () {

When the user clicks the element with class trigger and the Ajax request completes, the log message is displayed.

Hide a loading message after all the Ajax requests have stopped.

$(document).ajaxStop(function () {

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)