We can use defaul jQuery-ajax method for display ajax loader on multiple ajax request by using below formula.

var activeAjaxCount = 0;

$( document ).ajaxStart(function() {
activeAjaxCount++;
$(‘#msg_writter’).show();
});

$( document ).ajaxComplete(function() {
activeAjaxCount–;
if (activeAjaxCount == 0) {
$(‘#msg_writter’).hide();
}
});

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading...