The situation:
I have a site with multiple pages accessible through the menu, after login. On the dashboard page (the page you see right after login), there is a AJAX call getting the data from the PHP-Controller (zend framework). This call does about 20 queries to 2 different databases and a lot of data manipulations. It can take up to 5 seconds to load everything. So far, so good!
My problem:
When I go to another page through the menu, right after seeing the home page, the ajax call gets cancelled, and a new request is send to a new PHP-Controller. But because I'm working with php-sessions (through the zend-framework), I'm not able to do a new request before session_write_close() is called (at the end of the long-taking AJAX request). Is there a possibility that the previous call gets cancelled?
A not decent solution:
Right now, I've called session_write_close() at the beginning of my AJAX request, and this fixes the problem. Afterwards I still read from the session, but I've read, and confirmed that this is not an issue. Nevertheless, calling session_write_close() is not the prettiest thing to do, and I'm working with a few guys on this project, which has a lot of files and code paths, and won't be finished in the next 5 years... So I can't use session_write_close(), since this would not be maintainable. Especially because when you write to the session, PHP would not throw an exception. The data would simply not be saved.
So my question is:
Is there a decent alternative to session_write_close(), that let me interrupt/cancel an AJAX call (PHP-wise), to instantly go to another page, or is there a possibility to change a setting so that PHP would throw an exception when trying to write after session_write_close() is called?
Thanks In advance!