.ajaxStart() in jQuery

It will execute when the first Ajax request begins.

.ajaxStart()

// To add a “loading” indicator image when an AJAX request starts:

$(document).ajaxStart(function(){
    $(this).html(“< img src='demo_wait.gif' />“);
});