The usual sequence is to call the open method, set any custom header information using setRequestHeader, and the send with the send method. The response can be checked using one of the four response properties.
In the following example an XMLDOM document containing order information is posted to an ASP page which returns the result as a new XML document.
Code (JScript): function PostOrder (xmldoc) { var xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); xmlhttp.Open("POST", "http://guruserver/processorder.asp", false); xmlhttp.Send(xmldoc); return xmlhttp.responseXML; }
The ASP page then loads the posted XML document, processes it, and builds an XML document from the results.
Code (Server-Side JScript): <% Response.Expires=-1000; var doc = Server.CreateObject("Microsoft.XMLDOM"); doc.load(Request); // process and build resulting document var result=Server.CreateObject("Microsoft.XMLDOM") Response.ContentType="text/xml"; result.save(Response); %>