Bak ... https://stackoverflow.com/a/13090589/999958
Yararlı bir Benim için geçici çözüm: Her .complete (...) ajaxCallComplete() çağrısına bakın; Umut yardımcı olabilir
$(document).ready(function(){
loadPersons();
loadCountries();
loadCities();
});
// Define how many Ajax calls must be done
var ajaxCalls = 3;
var counter = 0;
var ajaxCallComplete = function() {
counter++;
if(counter >= ajaxCalls) {
// When all ajax calls has been done
// Do something like hide waiting images, or any else function call
$('*').css('cursor', 'auto');
}
};
var loadPersons = function() {
// Show waiting image, or something else
$('*').css('cursor', 'wait');
var url = global.ctx + '/loadPersons';
$.getJSON(url, function(data) {
// Fun things
})
.complete(function() { ajaxCallComplete(); });
};
var loadCountries = function() {
// Do things
var url = global.ctx + '/loadCountries';
$.getJSON(url, function(data) {
// Travels
})
.complete(function() { ajaxCallComplete(); });
};
var loadCities = function() {
// Do things
var url = global.ctx + '/loadCities';
$.getJSON(url, function(data) {
// Travels
})
.complete(function() { ajaxCallComplete(); });
};
... Temelde
gibi çözülür: http://stackoverflow.com/question ([birden asenkron bekliyorum devam etmeden önce tamamlanması çağrısında] s/2768293/bekleyen-çok-asenkron-aramalar-tamamlamak-devam-devam) –