我是用脚本宿主的。
var http=new ActiveXObject("Microsoft.XMLHTTP");
http.open("GET","http://www.sohu.com/",false);
http.onreadystatechange=onhandle;
http.setRequestHeader("Content-Type","text/xml");
http.send();function onhandle()
{
if (http.readyState == 4 && http.status == 200)
{
WScript.Echo(http.responseText);
WScript.Echo(http.responseXML.xml);
}
}
这里的http.responseText怎么是html格式的字符串,怎么让他返回xml格式的字符串啊。responseXML返回也为空,晕死了。帮帮忙吧。谢谢啦
var http=new ActiveXObject("Microsoft.XMLHTTP");
http.open("GET","http://www.sohu.com/",false);
http.onreadystatechange=onhandle;
http.setRequestHeader("Content-Type","text/xml");
http.send();function onhandle()
{
if (http.readyState == 4 && http.status == 200)
{
WScript.Echo(http.responseText);
WScript.Echo(http.responseXML.xml);
}
}
这里的http.responseText怎么是html格式的字符串,怎么让他返回xml格式的字符串啊。responseXML返回也为空,晕死了。帮帮忙吧。谢谢啦
document.write(http.responseXML); /*undefined 说明没有给responseXML赋值*/
document.write(typeof(http.responseXML.xml));/*string 说明该属性是存在的*/
document.write(http.responseXML.xml=="");/*true 说明xml属性值为空*/
response.getWriter().print("xml字符串");
return null;
response.setContentType("text/xml");
response.getWriter().print("xml字符串");//只需要输出你要的信息
return null;//不用返回
我用的echo
WScript.Echo(typeof(http.responseXML.xml)); 返回string,说明属性存在
WScript.Echo(http.responseXML.xml=="");这个返回的是 -1,怎么是 -1???
再次晕