I am using following code on a html page
window.onbeforeunload = function() {
return "You have made changes on this page that you have not yet confirmed. If you navigate away from this page you will lose your
unsaved changes"; }
when a user try to leave the current page the i ask the user a confirmation either he/she want to leave the page or not. there are two button 'leave the page' and 'cancle'
How can i know if user click on the leave button then i have to send a ajax request (that ajax request do some action in DB) .
Thanks in advance.