Ajax页面跳转不过去,执行成功后弹窗完页面不跳转

$("#myform").submit(function () {
$.ajax({
url: "/tools/shopus.ashx?action=Register",
//请求的url地址
data: $('#myform').serialize(),
type: "POST",
//请求方式
async: false,
cache: false,
success: function (data) {
alert(data);
window.location.href = "/ShopUser/Index";
},
error: function (req) {
alert(req);
}
});
});

$("#myform").submit(function () {
           $.ajax({
               url: "/tools/shopus.ashx?action=Register",
               //请求的url地址
               data: $('#myform').serialize(),
               type: "POST",
               //请求方式
               async: true,//这个地方修改
               success: function (data) {   
                       alert(data);
                       window.location.href = "/ShopUser/Index";   
               },
               error: function (req) {
                   alert(req);
               }
           });
           return false;//这个位置加一个返回失败
       });

温馨提示:内容为网友见解,仅供参考
第1个回答  2014-03-18
href里面index.html
你没加后缀名,它不认识追问

MVC不需要加后缀名,而且后缀是cshtml不是html

追答

js它认识mvc吗?

第2个回答  2014-03-18
貌似是路径不太对,可能是路径后缀,大小写问题吧
第3个回答  2014-03-18
好像没啥问题
你确定已经success了嘛?

如果确定了进入success 那就没有问题了吧

在或者你是在 iframe里面window.location.href什么的问题追问

已经success了能显示 alert(data);的结果,就是无法跳转页面

我直接放个http://www.baidu.com上去都跳不了

本回答被网友采纳
相似回答