I am using the code below to fire a confirmExit()
function when the user tries to leave the page:
window.onbeforeunload = confirmExit;
function confirmExit(){
return "Are you sure you want to exit this page?";
}
Furthermore:
The page also fires AJAX functions to update a database 'on the fly'. As a result, when the user leaves the page, I need to delete all that 'on the fly' data.
Is it possible to call a javascript function when the user clicks the 'Leave Page' button?