手机
当前位置:查字典教程网 >编程开发 >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的三种解析模式

ajax返回的json内容进行排序使用sort()方法实现

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

ajax 缓存 问题 requestheader

关于ajax的多次请求问题

Ajax的小贴士使用小结

JQuery ajax返回JSON时的处理方式 (三种方式)

Ajax的使用四大步骤

ajax的 IE cache 相关问题解决

Ajax简单的异步交互及Ajax原生编写

精品推荐
分类导航