验证失败,什么哪出错了呢?
function showHint(str){
if (str.length > 0 && str != null)
{
Customer.innerHTML="验证用户名....";
//var url="checkuser.asp?sid=" + Math.random() + "&CustomerID=" + str
var url="../Member/checkData.aspx?CustomerID=" + str
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}
else
{
document.getElementById("Customer").innerHTML=""
}
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var flag1;
var resStr = xmlHttp.responseText.substring(0,4);
if(resStr == "true")
{
flag1 = resStr;
}
else
{
flag1 = xmlHttp.responseText.substring(0,5)
}
if (flag1 =="false")
{
document.getElementById("Customer").innerHTML= "<img src='../RegImg/pic_right.gif'> " +"恭喜你,此用户名未被使用!";
document.getElementById("userID").value= "YES";
}
else if(flag1 =="true")
{
document.getElementById("Customer").innerHTML="<img src='../RegImg/pic_error.gif'> " +"对不起,此用户名已经存在!";
document.getElementById("Customer").className = "ss2"
document.getElementById("userID").value= "NO";
return false;
}
else
{
document.getElementById("Customer").innerHTML="<img src='../RegImg/pic_error.gif'> " +"验证失败!!";
document.getElementById("Customer").className = "ss2"
document.getElementById("userID").value= "NO";
return false;
}
}
else
return false;
return true;
}
checkData.aspx页面代码:
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
string CardId = this.CardId.Text.ToString();
SqlCommand cmd = new SqlCommand("select count(*) from Users where userid="+Request.QuryString["CustomerID"], strcon);
int count = Convert.ToInt32(cmd.ExecuteScalar());
if (count > 0)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
但是为什么返回的结果是验证失败呢??哪个代码错了.请帮忙看一下谢谢!!