我的登陆页面是用ajax提交的。提交成功后除了显示登陆成功的提醒信息外,还会返回一个url给js做页面跳转。
如下: http://127.0.0.1/demo/Home/User/login.html
提交表单后,后台返回一个jumpUrl="Home/Index", 用U('Home/Index')函数生成的。
然后在表单提交的回调函数里这样写
这个时候页面会跳转到http://127.0.0.1/demo/Home/Home/Index.html
多了一个Home.
如下: http://127.0.0.1/demo/Home/User/login.html
提交表单后,后台返回一个jumpUrl="Home/Index", 用U('Home/Index')函数生成的。
然后在表单提交的回调函数里这样写
- $.post(_post_url,data,function(result){
- if(result.code>0){ //失败
- $("#msg").html(result.msg);
- }else { //成功
- $("#msg").html(result.msg);
- setTimeout("location.href='"+result.jumpUrl+"'",1000);
- }
- });
复制代码
多了一个Home.