1

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?

ivan_pozdeev
  • 31,209
  • 16
  • 94
  • 140
ka_lin
  • 9,066
  • 6
  • 34
  • 52

0 Answers0