Harutyun Posted May 18, 2009 Share Posted May 18, 2009 Hi. I'm working on statistics application using php and mysql as back-end. The basic idea is to write any clicks' statistics to database when user clicks on any link on the site. My choice is synchronous AJAX request to server using onbeforeunload event. I'm using synchronous request to be sure that browser sent request to the server before page is unloaded. With asynchronous request much requests do not get to the server especially with slow connections. This approach works well so far, but as mysql database gets bigger, and php script more complicated, this will take more time to proceed request, which hangs browser for a little. I just thought is there any way to send response to browser, close the connection (this normally happens after exit or die() in php script) and only after that continue script execution. So we will be sure that request is sent to server, and browser will not wait so long until php executes all the back-end logic. I've tried headers 200 OK and connection: closed, but no success so far. Any ideas how to do it? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.