关于jquery ajax返回值判断问题
xb375 2011-09-20 02:06:29 js代码:
function LoginSuccess(){
$.ajax({
type:"POST",
url:"checkLogin.aspx",
data:{userName:$("#txtUser").val(),userPwd:$("#txtPassword").val()},
beforeSend:function(){$("#msg").html("logining");},
success:function(msg){
//这里msg经过测试,返回的确实是Login is false,但是始终无法执行if以下的语句
if(msg=="Login is false")
{
$("#msg").html(msg);
}
}
});
.cs后台代码:
string retVal = "";
string userName = Request["userName"];
string userPwd = Request["userPwd"];
if (userName == "test" && userPwd == "test")
{
retVal = "Login is Success";
}
else
{
retVal = "Login is false";
}
Response.Write(retVal);
Response.End();
问题描述:
本人菜鸟,反复折腾无用.但经过测试,js里面,返回值是对的,但是不能执行success下的if语句.求解!