dragunu Posted September 7, 2007 Share Posted September 7, 2007 hello, i would like to run a script to update a database once a page is closed. Now i am using the onUnload() function of js in the body tags of the window. so the code that i am using is similar to this: <script language='javascript'> function send_data() { location.href="updatedb.php"; } </script> <body onunload="send_data()"> </body> now i would like to run updatedb.php without actually loading it on the browser of the client. any suggestion? thanks and regards Link to comment https://forums.phpfreaks.com/topic/68335-calling-a-php-script-from-js-onunload/ Share on other sites More sharing options...
ToonMariner Posted September 7, 2007 Share Posted September 7, 2007 this is more an ajax job - as thw browser will close there is no need for the client to view another page so the above would fail to do its job of sending data AND closing the window. Link to comment https://forums.phpfreaks.com/topic/68335-calling-a-php-script-from-js-onunload/#findComment-343590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.