标签:microsoft val play return data user ng2 option pos
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>
标签:microsoft val play return data user ng2 option pos
原文地址:http://www.cnblogs.com/caohuimingfa/p/6411542.html