call function after all ajax requests complete successfully code example
Example 1: how to wait till jquery post request has been made
$.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){
});
function ajax1() {
return $.ajax({
url: "someUrl",
dataType: "json",
data: yourJsonData,
...
});
}
Example 2: loading page for all ajax call in jquery 3.3.1
$(document).ajaxStart(function () {
$('#ajax-loading-image').css("display", "block");
});
$(document).ajaxStop(function () {
$('#ajax-loading-image').css("display", "none");
});