i have a PHP process who send X mails After each mail send, i add a line on a database for tell that a mail is send.
So, i wan't to create a progress bar for tell to the user that X mails are sended on Y ( Y = total)
I have two jquery function like that :
function mail_send()
{
var refreshIntervalId;
$('.loading').css('display','block');
$.ajax({
'url': '/an/url/',
'data': {
someParam: param
},
'beforeSend':function()
{
$('#loadingBg').append('<span id="count"></span>');
refreshIntervalId =setInterval(function () {
mail_updateProgress(id);
}, 500);
}
,
'success': function (data,textStatus)
{
(....)
clearInterval(refreshIntervalId);
javascript: console.log(' send finish !!!');
}
});
}
function mail_updateProgress(id) {
javascript: console.log('updatePG');
$.ajax({
'url': '/an/url/',
'data': {
someParam: param
},
'success': function (data) {
var res = $.parseJSON(data);
javascript: console.log(' => data received ' + res.nbSended);
$('#count').html(res.nbSended + '/' + res.total);
}
});
}
Is there a queue for the $.ajax ? I'm loggin 3 things : first : When the process is enter on the updateProgress function second : when the updateProgress ajax is successed third : When the mail_send() ajax is successed
the order of the log is :
- updatePG => 100 times (i've made a sleep in my php code for test it)
- send finish !!! => 1 times
- => data received 11 => X times (i've send 11 mails)
So for me it's tell that there is a queue for the ajax call. But how can i perform my progress bar so ?
EDIT : It may be a php configuration problem,
Someone can tell me how allow multi connection from the same processus ?