Is it possible to halt a loop until each AJAX request has returned for every iteration?
for (var i = 0; i < 5; i++) {
var data = "i=" + 1;
var ajax = $.ajax({
url: '/ajax.php',
type: 'post',
data: data,
success: function(result)
{
//alert(result);
}
});
//code to pause the loop here
ajax1.done(function (result) {
//code to resume the loop here
});
}