Ajax responsexml return accepts ASP

Time:2022-7-23

First file index.asp
<script language=”javascript”>
var xmlHttp = false; //ajax usage
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>

 

The second 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>”)
%>

Recommended Today

linux learning

Linux 1 Overview is an operating system The difference between linux and centos 7 is like the difference between windows and windows 7 On the server side, Linux is very popular in the development world The server uses the command line, and we also learn based on the command line 2. Environment construction 2.1 Download […]