登录的Ajax请求
$.ajax(owner.getServerUrl()+'/get_login.action',{
data:{
logincode:owner.encrypt(loginInfo.account),
password:owner.encrypt(loginInfo.password),
clientid:owner.encrypt(loginInfo.clientid),
key:owner.mQUN1
},
dataType:'text',
type:'post',
timeout:10000,//超时时间设置为10秒;
xhrFields: {
withCredentials: true
},
success:function(data,xhr){
if(data.indexOf("success")>-1){
//owner.setCookie("meta.session.id="+data.split("@")[1])
return owner.createState(loginInfo, callback);
}
else{
return callback('用户名或密码错误');
}
},
error:function(xhr,type,errorThrown){
return callback('返回超时');
}
});
};
登录成功后
$.openWindow({
url:"pages/main/main.html", // 新页面的url
id:"main", // 新页面的id标识
});
页面加载完成后
$.ajax({
type:'post',
url:serverurl+'/appHeartJump.action',
dataType:'text',
async:false,
xhrFields:{
withCredentials:true
},
success:function(data){
console.log(data);
if(data=="ok"){
f2=true;
}else{
f2=false;
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log("ERROR");
f2=false
}
});