如何比较xmlhttp.responsetext? [英] how to compare xmlhttp.responsetext?
本文介绍了如何比较xmlhttp.responsetext?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码-
document.getElementById("lblmsg").innerHTML=xmlhttp.responseText;
if(xmlhttp.responseText == 'Available')
{
document.getElementById("newid").value = "";
}
尽管响应文本是 Available
,但在条件允许的情况下它仍然不会出现在里面?
although response text is Available
but still it is not going inside if condition???
推荐答案
嗯,应该可以.
您确定响应文本完全可用吗?尝试像这样修剪响应:
Are you sure that the response text is exactly Available? Try trimming the response like this:
if(xmlhttp.responseText.trim() == 'Available')
您有权使用Firebug吗?尝试使用console.log(xmlhttp)来找出responseText的确切值.
Do you have access to firebug? Try a console.log(xmlhttp) to find out the exact value of the responseText.
这篇关于如何比较xmlhttp.responsetext?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文