ajax request will be initiated by user click
It is impossible to know how many request will be sent
I tried ajaxComplete, but it is not work, I think it cannot detects ajax after the page loaded.
function ajax1() {
$.ajax({
url: 'getCount.php',
type: 'GET',
dataType: 'html',
success: function (data) {
var count = parseInt(data);
for (var i = 0; i < count; i++) {
ajax2();
}
}
});
}
function ajax2() {
$.ajax({
url: 'getCount2.php',
type: 'GET',
dataType: 'html',
success: function (data) {
var count = parseInt(data);
for (var i = 0; i < count; i++) {
ajax3();
}
}
});
}
function ajax3() {
$.ajax({
url: 'ajax3.php',
type: 'GET',
dataType: 'html',
success: function (data) {
//do something
}
});
}
$(document).ajaxComplete(function (event, xhr, settings) {
alert('Complete');
});