I have a php query manager that I call from AJAX with Jquery with an asynchronous GET, this manager is in charge of calling the relevant function.
One of these functions must execute a process that depends on the number of records that have been inserted until a certain date. If the number of records is small the process ends, the echo is done, ajax obtains the result and everything works correctly, but if the process is long it ends (I have a log that keeps the answer json and this is correct) but it seems that the echo is not made, since Ajax does not get any response and immediately starts the whole process again as if a new _GET call was made to the manager with the same parameters.
header("Content-Type: application/json; charset=UTF-8", true);
switch(mb_strtoupper($_GET['funcion'])){
[...]
}
$json = json_encode($respuesta);
Log::insertaLog('Gestor Consulta > Respuesta ' . $json);
// En ambos casos siempre se está guardando el registro del json y este es correcto, pero el _GET
echo($json); flush();
The ajax call:
$.ajax({ type: "GET", async: true, url: "/Code/Herramientas/GestorConsultas.php", dataType: "json", data: parametros, success: function (datos) { console.log(datos); }, error: function (peticion, mensaje) { console.log("Error invocacio: /Code/Herramientas/GestorConsultas.php " + parametros + " " + peticion + " " + mensaje); GNR_GestionaError(arguments.callee.name, mensaje); } })
I will appreciate any help.
Edited
If I execute the call to the function without going through the manager, it always executes correctly.