Is there a way to suspend jquery execution while waiting for requests to finish, so that you can track its progress? This is my code:
$("span").click(function() {
istrainning= true;
for (var i=0;i<1000;i++)
$.post("train.php",function(){
$(".progressbar").width((i/10)+"%");
$("label").html((i/10)+"%");
});
});
I want the statements
$(".progressbar").width((i/10)+"%");
$("label").html((i/10)+"%");
to execute only after finishing post request. please help.
--EDIT:
Sorry. It seems like my mistake is the 1000 requests being done all at the same time. is there a way to do it where all request will be done one at a time?