javascript代码:
function _startLoad()
{
var xmlHttp = XmlHttp.create();
xmlHttp.open("GET", sSrc, true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4)
{
var str = xmlHttp.responseXML;
}
};
window.setTimeout(function () {
xmlHttp.send(null);
}, 10);
}
function _startLoad()
{
var xmlHttp = XmlHttp.create();
xmlHttp.open("GET", sSrc, true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4)
{
var str = xmlHttp.responseXML;
}
};
window.setTimeout(function () {
xmlHttp.send(null);
}, 10);
}
XMLHTTP is a component of MSXML. XMLHTTP is designed to pass XML documents to programs over the Internet using the standard Hyper-Text Transfer Protocol (HTTP). An example of a program using XMLHTTP is the Outlook Web Access Client, which uses XMLHTTP to retrieve e-mails from a mail server. Another common use is for posting XML data to a web server.
http://www.microsoft.com/technet/security/bulletin/MS02-008.mspxhttp://www.devx.com/getHelpOn/10MinuteSolution/20358/1954?pf=true
到这里去看看,xmlhttp是微软的一个COM组件。
<html><head>
<script language="javascript">
function sendXml()
{
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("POST", "TestXml.aspx", false);
http.setRequestHeader("Content-Type","text/xml");
http.send("<root>hello" + Math.random() + "</root>");
if (http.status == 200)
alert(http.responseText);
else
alert(http.statusText);
}
</script>
</head><body>
<input type="button" value="send" onclick="sendXml()">
</body></html>
服务器端
<%@ Import Namespace="System.Xml" %>
<script language="C#" runat="server">
void Page_Load(Object o, EventArgs e)
{
if (Request.ContentType.ToLower() == "text/xml")
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(Request.InputStream);
Response.Write(xmldoc.InnerXml);
Response.End();
}
}
</script>