首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

为什么xmlhttp读不到数据?解决方法

2012-03-05 
为什么xmlhttp读不到数据????用Response.Write()输出:?xmlversion 1.0 encoding GB2312 ?rooti

为什么xmlhttp读不到数据????
用Response.Write()
输出:

<?xml   version= "1.0 "   encoding= "GB2312 "   ?>  
<root>
<info> ok </info>
</root>


用xmlhttp获取

var   xmlDoc   =   xmlhttp.responseXML;//有object,非null
//var   root   =   xmlDoc.documentElement;  
var   node   =   xmlDoc.getElementsByTagName( 'info ');//有object,非null

var   str   =   node[0].firstChild.data;//这里却是null!!!!!!用node[0].firstChild.nodeValue;也不行。。。


alert(str);

[解决办法]
xmlhttp.responseXML.是可以的.用操作xmldocument的方法来操作它.
[解决办法]
就是查xmldocument的用户手册。。。。
不过你之前已经在用这种方式了。应该是属性用错了吧。
你用node[0].firstChild.text看看
[解决办法]
node[0].InnerText;
[解决办法]
var str = node[0].innerText

热点排行
Bad Request.