asp.net mvc 微软异步请求
2017-02-17 21:12
183 查看
public ActionResult GetDateTime(string userName,int age) { System.Threading.Thread.Sleep(2000); return Content(DateTime.Now.ToString() + userName + age); } public ActionResult MicroSoftAjax() { return View(); }
@{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>MicroSoftAjax</title> <script src="~/Scripts/jquery-1.8.2.js"></script> <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script> <script type="text/javascript"> function afterSuccess(data) { alert("成功回调"+data); } </script> </head> <body> <div id="divLoading" style="display:none"> <img src="~/Content/Images/ico_loading2.gif" /> </div> <div> @using (Ajax.BeginForm("GetDateTime", "User", new AjaxOptions() { Confirm="您真的要提交吗?", HttpMethod="Post", InsertionMode=InsertionMode.Replace, UpdateTargetId = "divResult", OnSuccess="afterSuccess", LoadingElementId="divLoading" })) { <div> 用户名:<input type="text" name="userName"/><br/> 年龄:<input type="text" name="age"/><br/> <input type="submit" value="提交"/> </div> } <div id="divResult"></div> </div> </body> </html>
相关文章推荐
- ASP.NET WebForm 之 Ajax 请求后端处理 概述 ASP.NET 在MVC中的用途非常广泛,操作起来也非常简单。前台请求异步请求 Controlle
- asp.net mvc放在iis7.5中提示404错误 js异步请求失效解决办法
- MVC4 AspNet MVC下的Ajax / 使用微软提供的Ajax请求脚本 [jquery.unobtrusive-ajax.min.js]
- 微软ASP.NET MVC Beta版本发布
- jQuery成为微软Visual Studio和ASP.NET MVC的一部分
- 为ASP.NET MVC扩展异步Action功能(下)
- Ajax异步请求asp.net页面
- 使用微软ASP.NET MVC Framework的一些感受 + 收集园子朋友发现的bug反馈
- ASP.NET MVC深度接触:ASP.NET MVC请求生命周期
- 微软将要推出自己的MVC框架(altnetconf - Scott Guthrie announces ASP.NET MVC framework at Alt.Net Conf)
- 微软发布ASP.NET MVC框架1.0正式版(附下载地址)
- 使用ASP.NET MVC Futures 中的异步Action
- 使用ASP.NET MVC Futures 中的异步Action 推荐
- 为解决ASP.NET MVC(CTP)中URL“页面请求”和“单纯逻辑处理请求”混淆问题,提供一条思路
- 为ASP.NET MVC扩展异步Action功能(上)
- 使用ASP.NET MVC Futures 中的异步Action
- 详解ASP.NET MVC的请求生命周期[转]
- Asp.net Mvc Preview 5 体验--实现ActionSelectionAttribute来判断是否为AJAX请求而选择不同的Action
- ASP.NET异步请求处理(Asynchronous Http Handlers)
- 微软发布ASP.NET MVC 1.0正式版