Dear, I do not know how to solve this, I have a json that I receive from php in the response variable, and what I want is to go through it as I do in the for, and in turn call another php that takes a little while to respond, the The issue is that I want you to wait for me to finish executing each php call in the for, how should I use it correctly with callback I guess? but I do not understand how to do. THANK YOU!
var response = JSON.parse( ajax_request.responseText );
// La variable response ahora contiene un objeto con los datos recibidos
//alert (response.length);
for (var i in response){
var aqueMaestra = response[i].maestra;
//aviso por mails---------------------------------
var variable_post=ElDocumentoES+","+aqueMaestra;
$.post("aviso-docentes.php", { variable: variable_post }, function(data){
$("#poptexto").html("Enviando mail a "+response[i].nombre);
});
if(i >= response.length-1)location.reload();
}