• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ajax的 responseXML返回接受 asp

2022-2-5 17:03| 发布者: 菜鸟教程小白| 查看: 661| 评论: 0|原作者: [db:作者]|来自: [db:来源]

摘要: 第一个文件index.asp scriptlanguage="javascript" varxmlHttp=false;//ajax使用 try{ xmlHttp=newActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ xmlHttp=newActiveXObject("Microsoft.XMLHTTP"); }catch(e2){ ...
第一个文件   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人参与评论

请发表评论

全部评论

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap