I know there is already a question and answer found here, and this is where i got my example. The question is: Other question
Here is my code:
$('.start').click(function() {
Generate();
})
function Generate()
{
var _p = Promise.resolve();
customers.forEach(customer =>
_p = _p.then(() => AxCall(customer))
);
}
function AxCall(v)
{
$.ajax({
url: '/generate/axgenerate/'+v['clm_customer_id'],
complete: function() {
count++;
$('.completed').text(count);
}
})
}
The problem is that still here the ajax called are all fired at once. How can i do that the ajax call is fired one after the other, even if it failed or succeeded