I'm using jQuery to show a confirmation message for the user when leaving the page as follows:
var changes = false;
window.onunload =function() {
if (changes) {
$.post("check.php",{undovideokey:VID});
} else return null;
};
on the other hand
<input type='submit' name='Add' value='submit ' align='right' onclick="changes = true;" />
A problem occurs when running the code in Google Chrome when I refresh the page. I have seen many problems like this but there is not helpful answers.
window.onbeforeunload ajax request in Chrome
thanks, Sara