How do you close an ajax request from php before the script ends? Example: user requests php.php, which has the line: echo "phpphp", and after this line, the ajax request finishes and has the data "phpphp", but the PHP script keeps on running, without using processes or forking?
How do i implement this scenario using PHP? has the answer. Set Connection close and Content length headers, with the flushing.
ob_start();
echo "111";
header("Content-Length: ".ob_get_length());
header("Connection: close");
flush();
somescript();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With