Jump to content

calling a php script from JS onunload


dragunu

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.