asp.net-mvc – 使用jQuery ASP.NET MVC自动保存表单输入
发布时间:2020-12-16 04:04:22 所属栏目:asp.Net 来源:网络整理
导读:我们希望实现一个自动保存内容的网络表单.类似于gmail / google docs的东西自动保存功能. 有人可以建议如何使用ASP.NET MVC jQuery实现这一点吗? 解决方法 jQuery Forms plugin和ASP.NET MVC操作应该完成这项工作: public ActionResult SaveDraft(FormColl
我们希望实现一个自动保存内容的网络表单.类似于gmail / google docs的东西自动保存功能.
有人可以建议如何使用ASP.NET MVC jQuery实现这一点吗? 解决方法
jQuery Forms plugin和ASP.NET MVC操作应该完成这项工作:
public ActionResult SaveDraft(FormCollection form) { // TODO: Save the form values and return a JSON result // to indicate if the save went succesfully return Json(new { success = true }); } 在您的视图中,只需定期调用此操作: setInterval(function() { $('#theFormToSave').ajaxSubmit({ url : 'SaveDraft',success: function (data,textStatus) { if (data.success) { alert('form successfully saved'); } } }); },30000); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – viewbag和viewstate之间的区别?
- asp.net-mvc-4 – 如何使用ASP.NET MVC在Kendo UI Grid中实
- asp.net-mvc-3 – “update-database”的实体框架SQLMigrat
- asp.net-mvc – 在visual studio中快速更改视图和控制器的方
- asp.net – 可以通过VS2015在IIS中调试/运行aspnet5应用程序
- ASP.NET Azure中的Trace.WriteLine
- asp.net-mvc-3 – 使用@ Html.Raw有风险吗?
- Azure 上部署 ASP.NET Core Web App
- asp.net-mvc-3 – 模型绑定器和隐藏字段
- asp.net – precompiledApp.config的目的是什么?
推荐文章
站长推荐
热点阅读