That's how ajaxStart works, from the docs:
Description: Register a handler to be called when the first Ajax request begins
I think you should show and hide the loader for each ajax call manually, call $( "#loader" ).show(); before the ajax call and then use the complete option of the ajax to hide it , like this:
$( "#loader" ).show(); $.ajax({ type: "POST", url: url, data: data, success: function(msg) { //stuffs }, complete: function() { $( "#loader" ).hide(); } });
Edited:
If you don't want to edit your ajax requests, maybe you could try ajaxSend() and ajaxComplete(), which are supposed to be executed for all ajax calls, instead of ajaxStart() and ajaxStop():
$(document).ajaxSend(function() { $( "#loader" ).show(); }); $(document).ajaxComplete(function(){ $( "#loader" ).hide(); });
ajaxStartfrom the jquery website states "Register a handler to be called when the first Ajax request begins." - That is, it's supposed to be called when the first Ajax request begins, as you've noted..ajaxStopfires when there are no pending AJAX requests.