I have the following code:
for (i=1;i<=pages;i++) {
$('#procout').append(Processing Page#"+i+"<br />");
$.ajax({
url: 'processor.php',
data: {storen: perpage, pagen : i},
success: function(data) {
$('#procout').append(data+"<br />");
}
});
}
What I am trying to do is make the script wait for the Ajax response after every loop. Instead it prints out the "Processing Pages" lines all together and the the Ajax responses from each run in the order the server responds (out of order). I tried setting the async option to false, but that simply causes the JS to wait until all six requests are done and then output everything from all runs together.
Note: The values of the pages, perpage, and pagen are irrelevant to the issue.