I’m using ExeOutput for PHP 1.6. My application launches several processes that run in the background. The main app makes ajax calls that last for several minutes and I’m using other ajax calls to monitor their progress. I’m also using ajax calls to terminate the long processes, should the user initiate this from the interface.
The problem is that, when I close the window from the X icon, the process hangs. The window does not close and the background processes continue to run until they end. If I end the process from the Task Manager, then the window closes.
So I’m looking for a way to:
a) either run some sort of HEScript function to “terminate” all running PHP processes
b) or run (but reliably) some ajax calls to terminate the processes myself.
I was thinking about using the window onunload javascript event and bind the ajax calls to that, but ajax calls are by default async, so calling them on a javascript event would immediately return the control to the event handler and I would have no guarantee that the ajax calls would complete. Maybe using sync ajax calls would solve the problem, but I thought I’d ask first if there isn’t any reliable way to execute code when the main window is closed.
Thanks!