Cancel PHP script with XHR?
问题 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