源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

ajax的 responseXML返回接受 asp

  • 时间:2021-10-01 19:19 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:ajax的 responseXML返回接受 asp
第一个文件   index.asp <script language="javascript"> var xmlHttp = false;    //ajax使用 try {   xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {   try {     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");   } catch (e2) {     xmlHttp = false;   } } if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {   xmlHttp = new XMLHttpRequest(); } function callserver() {  var url = "index.asp";  xmlHttp.open("POST",url,true);  xmlHttp.onreadystatechange = update;     xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded");  xmlHttp.send(null); } function update() {  if(xmlHttp.readystate==4)  {   var xmldoc=xmlHttp.responseXML   var info = xmldoc.getElementsByTagName("info")[0].text;   alert(info);  } } callserver(); </script>   第二个   login.asp <% Response.ContentType="text/xml" response.Write("<?xml version='1.0' encoding='GB2312' ?>") response.Write("<root>") response.Write("<info>love you</info>") response.Write("</root>") %>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部