loadCount = 0;
(function load() {
loadCount++;
if (loadCount < myArray.length) {
setTimeout(function () {
myData = myArray[loadCount];
$.ajax({
url: requestURL,
type: 'POST',
headers: postHeaders,
data: myData,
complete: load
});
}, 100 * (loadCount + 1));
} else {
return false;
}
}());
Only way I'm able to fix it is async: false
async means, that your code doesn't wait for a response of the request but simply continues and makes the Ajax request in the background
try to use success instead of complete, maybe that works?
It doesn't
Обсуждают сегодня