
if(responseContext.indexOf("true")!=-1)是什么意思?
使用Ajax技术来实现用户名是否可用中的functionprocessor(){varresponseContext;if(xmlHttp.readyState==4){...
使用Ajax技术来实现用户名是否可用中的
function processor(){
var responseContext;
if(xmlHttp.readyState==4){//如果响应完成
if(xmlHttp.status==200){//如果返回成功
responseContext = xmlHttp.responseText;
if(responseContext.indexOf("true")!=-1){
alert("恭喜您,该用户名有效!");
}
else{
alert("对不起,该名字已经被别人使用!");
}
}
}
if(responseContext.indexOf("true")!=-1)是什么意思? 展开
function processor(){
var responseContext;
if(xmlHttp.readyState==4){//如果响应完成
if(xmlHttp.status==200){//如果返回成功
responseContext = xmlHttp.responseText;
if(responseContext.indexOf("true")!=-1){
alert("恭喜您,该用户名有效!");
}
else{
alert("对不起,该名字已经被别人使用!");
}
}
}
if(responseContext.indexOf("true")!=-1)是什么意思? 展开
1个回答
展开全部
是从服务器返回的值里面有"true"这个字符串.
indexOf的检查字符串中有没有指定的子字符串.并返回子字符出现在字符串中的索引.当不包含的时候.返回-1.
indexOf("true")!=-1就是说包含这个"true"子字符串.
indexOf的检查字符串中有没有指定的子字符串.并返回子字符出现在字符串中的索引.当不包含的时候.返回-1.
indexOf("true")!=-1就是说包含这个"true"子字符串.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询