I have a question. I need to cancel an AJAX request on the client side and on the server side.
On the client side I use abort()
var requisicao = $.ajax({ url : 'xyz.php' });
if(requisicao && cliente_abortou_requisicao){
requisicao.abort();
}
Now on the server side I'm doubtful. How do I stop PHP from executing? For example, if you just do the client side, the script still runs on the server and if I make another AJAX request to the server this request is waiting for the previous request to finish.
Example:
<?php
$DB = getConexaoOracle();
$sql = "SELECT * FROM FUNCIONARIOS"; // 1 milhão de registros (exemplo)
$RS = $DB->Execute($sql);
$array_de_retorno = array();
while($RS->hasNext()){
...
}
die(json_encode($array_de_retorno));
?>
Would anyone know how I can handle this session being aborted by the client?