jQuery > Ajax methods

.ajaxStop() - Knowing when all ajax request stopped in jQuery

How to know when all ajax request is stopped and no other ajax activity is in process in jQuery?


To know when all ajax request is completed and no other ajax activity is in process, ajaxStop() method can be used. This event fires after .ajaxComplete() event.

 <script>
         $(document).ajaxStop(function () {
            $("#divAjaxStop").text("ajaxStop: Ajax request stopped : ");
        });
    </script>

In the above code snippet, when all ajax request is complete “ajaxStop = Ajax request stopped : “ is written in the “divAjaxStop” element.

Important

Note that this event fires irrespective of ajax request is completed successfully or not. This event can be used to hide the loading message or progress bar.

 Views: 994 | Post Order: 116



Write for us