Annie
Annie

Reputation: 131

Quiting the page before a form submission

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

Upvotes: 0

Views: 67

Answers (2)

Jared Updike
Jared Updike

Reputation: 7277

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

Upvotes: 0

OneOfOne
OneOfOne

Reputation: 99225

Try using jQuery + ajax in your onbeforeunload handler.

Upvotes: 1

Related Questions