Originally while exiting the page, i used to do anything.This is how i used to alert the user
return('You have attempted to leave this page.If you have made any changes to the fields without clicking Submit button,This Data will be saved as This Month Report.Are you sure you want to exit the page?');
But now i have to call a server side script based on user answer.If he decides to Quit, i have call server side function.I have written the code as below, but It gives the the message" you have attempted", and then also gives confrim message.I dont want that confirm message. I want only The "you have attempted to leave" message.If i remove the confirm () , then how do i alert the user. Where do i put these retun statemets.
var showUnloadMessage = true;
if(confirm("You have attempted to leave this page.If you have made any changes to the fields without clicking Submit button,This Data will be saved as This Month Report.Are you sure you want to exit the page?"))
PageMethods.Message(); /*this is for Server method calls*/.
window.onbeforeunload = window_OnBeforeUnload; /* This is how i call Before quiting*/