I tried to use the update function with onunload but the function wasn’t invoked. How can invoke the update function on leaving or closing the current page? Thanks
jQuery(document).ready(function($){
function update()
{
$.post('http://www.example.com/scripts/home.php');
}
});
It’s a bad design to do stuff
onunload. You should change your design to something that doesn’t rely on this event.If you must have to, try doing your call in
onbeforeunload.