http://www.w3schools.com/dom/dom_http.asp
The HttpRequest Object Provides Client-Side Communication with a server.
The httpRequest Object
With the httprequest Object You can send a request from the client to the server.
IF you are useless Javascript in IE 5.0, You Create the httprequest Object with the folload code:
VAR XMLHTTP = New ActiveXObject ("Microsoft.xmlhttp")
IF you are useful vbscript you create the httprequest object with the folowing code:
SET XMLHTTP = CreateObject ("Microsoft.xmlhttp")
The HttpRequest Object is not a part of the w3c dom standard.
Get XML
How to get an xml file from the server using the httprequest object (Works Only In IE):
VAR XMLHTTP = New ActiveXObject ("Microsoft.xmlhttp") XMLHttp.Open ("get", "Note.XML", FALSE) XMLHTTP.SEND () XmLDoc = XMLHTTP.RESPONSETEXT
TRY IT yourself
Netscape Compatible Code:
Xmlhttp = new xmlhttpRequest (); xmlhttp.open ("get", "note.xml", false; xmlhttp.send (null); xmldoc = Xmlhttp.ResponseText;
TRY IT yourself
Send XML
You can also send an Xml Document to an ASP Page on The Server, Analyze The Request, And Send Back The Result.
VAR XMLHTTP = New ActiveXObject ("Microsoft.xmlhttp") XMLHttp.Open ("Post", "Demo_DOM_HTTP.ASP", FALSE) XMLHTTTP.send (XmLDoc) Document.write (Xmlhttp.Responsetext)
The ASP Page, Written In Vbscript:
set xmldoc = Server.CreateObject ( "Microsoft.XMLDOM") xmldoc.async = false xmldoc.load (request) for each x in xmldoc.documentElement.childNodes if x.NodeName = "to" then name = x.text next response. Write (name)
You Send The Result Back to The Client Using The Response.write property.
Try it yourselfimportant Note
At The Moment, The Microsoft Xmlhttp Object Can Only Be Run in The Browser.
Server code That Attempts to use the xmlhttp to communicate with other web servers, May function incorrectly or perform poorly.
..........................
....................... ..
The HttpRequest Properties
PropertyDescriptionreadyStateReturns the state of the documentresponseBodyReturns the response as an array of unsigned bytesresponseStreamReturns the response as an IStreamresponseTextReturns the response as a stringresponseXMLReturns the response as an xml documentstatusReturns the status code as a numberstatusTextReturns the status as a string
The HttpRequest Methods
PropertyDescriptionabort () Cancel the current http requestgetAllResponseHeaders () Returns the value of the http headersgetResponseHeader (headerName) Returns the value of one specified http headeropen (method, url, async, userid, password) Opens http request, and specifies the informationsend () Send THE HTTP Request to the ServerSetRequestHeader (Headername, Headervalue) Specifies the Name