jQuery ajaxStop

This AJAXEvent ajaxStop registers a handler to be executed when all Ajax requests have completed.

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, do the following

Add jQuery libs from CDN into head section in HTML page

Write few HTML tags into body section

Add ajaxComplete event into head section

The complete HTML page

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

Thanks for reading.



Leave a Reply

Your email address will not be published. Required fields are marked *