Ajax Events

Welcome to our free jQuery tutorial. This tutorial is based on Webucator's jQuery Fundamentals Training course.

Contact Us or call 1-877-932-8228
Ajax Events

Ajax Events

Often, you'll want to perform an operation whenever an Ajax requests starts or stops, such as showing or hiding a loading indicator. Rather than defining this behavior inside every Ajax request, you can bind Ajax events to elements just like you'd bind other events. For a complete list of Ajax events, visit http://docs.jquery.com/Ajax_Events.

Creating a Loading Indicator Using Ajax Events

$('#loading_indicator')
	.ajaxStart(function() { $(this).show(); })
	.ajaxStop(function() { $(this).hide(); });
Note: the $.fn.ajaxStart and $.fn.ajaxStop functions are not invoked for JSONP requests.
Next

This tutorial is based on Webucator's jQuery Fundamentals Training Course. We also offer many other jQuery Training courses. Sign up today to get help from a live instructor.