I have a PHP application that does lengthy processing operations on databases. Those operations are processed using AJAX calls. When an AJAX call is triggered, the UI becomes blocked using the JQuery BlockUI Plugin (http://malsup.com/jquery/block/). In the message appearing, I included a button to cancel the request/processing if it is taking too long. I want the following behaviour:
When the "Cancel" button is clicked, all active AJAX calls must be aborted. Then, since the PHP script called is still running on the server side, I will trigger another AJAX call to set a PHP session variable to false. In the PHP script, I am constantly checking for the value of this variable so that if it is false, then I exit() the current script.
Could anyone please give me insight on how I can possibly trigger the aborting of all AJAX calls on pressing a "Cancel" button? In addition, is there a way in a PHP script to launch a separate thread that constantly checks for a session variable's value and accordingly exits all running PHP scripts/functions or at least the current one?
Thanks in advance, Jeremie