I have with your help:
function send(){
$.get("/site/send.php", function(data){
alert(data);
}
}
In site/send.php I have:
for($=0;$i++;$i<1000)
sleep(1);
}
echo "OK";
Next I have in my js file:
send();
$("#click").click(function(){
window.stop(); // this cancel XHR
$.get("/site/reset.php", function(data){
alert(data);
}
})
and in reset.php:
echo "RESET";
window.stop(); cancel my XHR but this still doesnt working OK. i cancel XHR, but still i must wait for sleep(1000) in function send(). This doesnt return anything, but still continues to execute. Only if sleep is > 1000 then /site/reset.php begins to execute.
how can i in this example cancel PHP function?
is possible check in PHP file check if XHR still isset?