1.点击登录后未跳转到我设置的页面,而跳转到了后台接口的请求界面
$(function(){
login_json={
init:function(){
//初始化登录
this.logins();
//初始化记住密码
this.clickRemeber();
},
logins:function(e){
var _this = this;
$("#loginForm").submit(function(message){
if(!$("#loginname").val())
return alert("用户名不能为空!!!");
if(!$("#password").val())
return alert("密码不能为空!!!");
$.ajax({
url:"/dzwwz/Services/HYXX.ashx",
type:"get",
data:{"action":"login","HY":$("#loginname").val(),"pwd":$("#password").val()},
dataType:"json",
success:function(data){
if(data != ""){
var time = new Date();
time.setTime(date.getTime() + (60 * 60 * 1000));//coockie保存一小时
$.cookie("email",data.YX,{expires:time});//邮箱
$.cookie("alias",data.NC,{expires:time});//别名:昵称
location.href = '../member/user.html';
}else{
alert("用户名或密码错误!!!")
}
},
error:function(e){
console.log(e);
}
})
});
return false;
},
getUrlParam:function(name){//获取url中的参数信息
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if( r != null)
return (r[2]);//unescape解码urlencode
return null;
},
clickRemeber:function(){
$("#savepwd").on("click",function(e){
// alert($('[name="pwdcheckbox"]').is("checked"));
})
}
}
login_json.init();
})
这里是我写的js代码,是否有问题?
点击登录后跳转到这里
![这里是后台接口的请求界面][1]
想问是我的js问题还是后台获取session的问题?
你改成绝对路径试一下。是不是你的路径你没写对,