我有这段代码,在FireFox中似乎无法正常工作
SignIn: function () {
$("#message-box").hide();
var RememberMe = false;
if ($('#RememberMe').is(':checked') == true) {
RememberMe = true;
}
$.ajax({
url: "/Home/AuthenticateUser",
data: { UserEmail: $("#Login-UserEmail").val(), UserPassword: $("#Login-UserPassword").val(), RememberMe: RememberMe },
type: "POST",
success: function (data) {
if (data != "") {
$("#message-box").html(data);
$("#message-box").slideDown();
} else {
// alert("test") this dont fire either even though data ==""
window.location.href = "/Dashboard/";
//tried window.location = "/Dashboard/"; not work either
}
},
error: function (data) {
alert(data);
}
});
},
答案 0 :(得分:1)
我有这段代码,在FireFox中似乎无法正常工作
SignIn: function () {
$("#message-box").hide();
var RememberMe = false;
if ($('#RememberMe').is(':checked') == true) {
RememberMe = true;
}
$.ajax({
url: "/Home/AuthenticateUser",
data: { UserEmail: $("#Login-UserEmail").val(), UserPassword: $("#Login-UserPassword").val(), RememberMe: RememberMe },
type: "POST",
dataType:"text",
success: function (data) {
if (data != "") {
$("#message-box").html(data);
$("#message-box").slideDown();
} else {
// alert("test") this dont fire either even though data ==""
window.location.href = "/Dashboard/";
//tried window.location = "/Dashboard/"; not work either
}
},
error: function (data) {
alert(data);
}
});
},
我需要指定dataType:“text”才能在FF中工作。在FF中,当数据为“”时它返回[object object],所以当我检查if(data!=“”)时,在FF中它总是为真。