I have a clunky ajax queue that uses setTimeout and a global flag:
var InProgress = false;
function SendAjax(TheParameters) {
if (InProgress) {
setTimeout(function () { SendAjax(TheParameters) } , 500)
}
InProgress = true;
$.ajax({
...
data: TheParameters,
complete: InProgress = false
});
}
How can I rewrite this using a queuing mechanism so that the requests trigger one after the other in the order they're received?
Thanks.
Aucun commentaire:
Enregistrer un commentaire