i am using ajax and jquery to send an *synchonou*s http request to a php script in a web aplication to log out the user if incase the user decides to leave the page rather than logout.
i am using hte following code:
function close()
{
return "If you exit you will be logged out ...!";
}
window.onbeforeunload = close;
$(window).unload( function () {
$.ajax({
url: "logout.php",
async:false,
success: function(msg){
alert( "You have been logged out ...!");}
});
});
the ajax is working in ALL cases apart from when i press the back button. When i press the back button i even get the success function running but when i check the php script has not run as i have a fwrite function in it to tell me it worked. it is working in other cases apart from the back button.