第一个文件 index.asp
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();
第二个 login.asp
<%
Response.ContentType=”text/xml”
response.Write(“”)
response.Write(“”)
response.Write(“love you”)
response.Write(“”)
%>