手机
当前位置:查字典教程网 >编程开发 >AJAX相关 >ajax的 responseXML返回接受 asp
ajax的 responseXML返回接受 asp
摘要:第一个文件index.aspvarxmlHttp=false;//ajax使用try{xmlHttp=newActiveXObject("M...

第一个文件index.asp

<scriptlanguage="javascript">

varxmlHttp=false;//ajax使用

try{

xmlHttp=newActiveXObject("Msxml2.XMLHTTP");

}catch(e){

try{

xmlHttp=newActiveXObject("Microsoft.XMLHTTP");

}catch(e2){

xmlHttp=false;

}

}

if(!xmlHttp&&typeofXMLHttpRequest!='undefined'){

xmlHttp=newXMLHttpRequest();

}

functioncallserver()

{

varurl="index.asp";

xmlHttp.open("POST",url,true);

xmlHttp.onreadystatechange=update;

xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");

xmlHttp.send(null);

}

functionupdate()

{

if(xmlHttp.readystate==4)

{

varxmldoc=xmlHttp.responseXML

varinfo=xmldoc.getElementsByTagName("info")[0].text;

alert(info);

}

}

callserver();

</script>

第二个login.asp

<%

Response.ContentType="text/xml"

response.Write("<?xmlversion='1.0'encoding='GB2312'?>")

response.Write("<root>")

response.Write("<info>loveyou</info>")

response.Write("</root>")

%>

【ajax的 responseXML返回接受 asp】相关文章:

有关ajax的error与后台的异常问题解决

ajax 返回值自动添加pre标签的解决方法

Ajax的jsonp方式跨域获取数据的简单实例

ajax的responseText乱码的问题的解决方法

ajax的两种提交方式(get/post)和两种版本

ajax poller

比较Ajax的三种实现及JSON解析

ASP.NET与Ajax的实现方式小总结

ajax请求之返回数据的顺序问题分析

分享ajax的三种解析模式

精品推荐
分类导航