简体   繁体   English

提交表单之前退出页面

[英]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. 我在脚本中使用window.onbeforeunload()。 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 谢谢

尝试在onbeforeunload处理程序中使用jQuery + ajax

JavaScript调用的URL应该是具有您需要的onLoad方法的表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM