success: function(res) {
var obj = jQuery.parseJSON(res);
var loginResponse = obj.Result.success;
alert(loginResponse);
if(loginResponse = "true")
{
location.href = "http://www.google.com/"
}
else
alert("Login Failed");
}
});
我的资源如下:
{"Result":{"success":true,"userId":"ssressWRTc","dateOfFirstLogin":"2014-03-15 05:24:40"}}
但它总是警告"登录失败"即使成功是真的。
答案 0 :(得分:0)
var obj = {
"Result": {
"success": true,
"userId": "ssressWRTc",
"dateOfFirstLogin": "2014-03-15 05:24:40"
}
};
var loginResponse = obj.Result.success;
alert(loginResponse);
if (loginResponse === true) {
window.location.href = 'http://www.google.com';
} else alert("Login Failed");