views:

23

answers:

2

In my application I am showing the warning message when the user want to leave the page before submitting the form. I am using window.onbeforeunload() in the script. My application has a Master page.

I have four different views for a single form. I am inserting record in first view itself. When user quits the page I want to make some DB change(deletion of record). That's why I want to call a server side function from the script.

How to do it ? Can anybody suggest something ?

Thanks

+1  A: 

Try using jQuery + ajax in your onbeforeunload handler.

OneOfOne
JQuery rocks +1
MitMaro
A: 

The URL that the JavaScript calls should be a form with an onLoad method that does wha tyou need.

Jared Updike