Let`s say I am making 2 AJAX requests which are canceled by the user via js:
currentRequest.abort();
Both requests should have edited a file. After the second cancel, the first request is taken into account (even if it was aborted).
PHP:
<?php
ignore_user_abort(true);
if(isset($_GET['edit'])) {
sleep(10);
} else {
sleep(3);
}
if (connection_aborted () != 0) {
die(); // if the request was canceled
} else {
//do magic
}
Does it have to do with an Apache config?
I have to do this because I want to simulate a server delay, any ideas to stop the previous request?