问题:
页面代码:
//登录请求发送前执行 function begin() { $.msgBoxObj.showWait("登录中,客官请稍后~~"); } //接收到响应报文后执行 function complete(xhrObj) { $.msgBoxObj.hide(); responseText = { "Status": 1, "Msg": "登录成功了~", "BackUrl": "/Home/Index", "Data": null } $.msgProcess(xhrObj.responseText); } </script> @using (Ajax.BeginForm(new AjaxOptions() { HttpMethod = "post", OnBegin = "begin", OnComplete = "complete" })) { //省略输入框 }
输入正确信息提交表单并没有跳转到新页面,而是出现以下截图:
解决:
原来_Layout.cshtml的引用在要最下面,嘿嘿,所以果断直接把jquery.unobtrusive-ajax的引用放在了jquery后,
还要注意:js要用1.8.0以上
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
成功跳转
参考文章:https://blog.csdn.net/qq_20353957/article/details/48656991