Can I do ajax on 'Leave page' button? Below is my code:
window.onbeforeunload = function (event) {
var message = '';
if (typeof event == 'undefined') {
event = window.event;
}
if (event) {
event.returnValue = message;
}
return message;
}