0
I’m sending an email to a list of say 100 people, process this sending via Ajax, the normal is the ajax send to a page and in Success or error of it, it gives me the return what occurred, until then blz, I’m already doing with Ajax and PHP, however i want to see if it is possible that the return is one by one as the while of php is processing the upload, example:
Iniciando envio 1....
Email 1 enviado com sucesso
Iniciando envio 2...
Email 2 enviado com sucesso
Iniciando envio 3...
Email 3 enviado com sucesso
Iniciando envio 4...
Erro no envio do Email 4
And so on until the list is finished, today it returns me all that message quoted above at once, only after finishing while all of php. Below the ajax code I’m using
$('#ideMarketing').change(function () {
var ideMarketing = $('#ideMarketing').val();
if (ideMarketing == "") {
$('#verificandoEmail').html("");
$("#resultVerificandoEmail").html("");
$('#assunto').val("");
$('#htmlMensagem').val("")
} else {
$.ajax
({
type: 'POST',
dataType: 'json',
url: 'pagina_processamento.php',
beforeSend: function () {
$("#resultVerificandoEmail").html("");
$('#verificandoEmail').html("<img src='img/load.gif' id='load'>");
},
data: {
ideMarketing: ideMarketing
},
success: function (msg) {
$('#resultVerificandoEmail').html(msg);
}
});
}
})
So, I do the process of sending by php, ajax is only to not have to leave the page, but I send the return to Success: Function (msg) { $('#resultVerificandoEmail'). html(msg); } from jquery, which I’m analyzing how to do even in php, but I still can’t think of a logic for php and mysql for each reply send to ajax and then repeat the process until it’s over.
– Jorge Kania