XML DOM - HttpRequest object

From http://www.w3schools.com (Copyright Refsnes Data)

# The XMLHttpRequest Object

## Examples

Load a textfile into a div element with XML HTTP

Make a HEAD request with XML HTTP

Make a specified HEAD request with XML HTTP

List data from an XML file with XML HTTP

## The XMLHttpRequest Object Reference

### Methods

Method | Description
--- | ---
abort() | Cancels the current request
getAllResponseHeaders() | Returns the complete set of http headers as a string
getResponseHeader("headername") | Returns the value of the specified http header

open("method","URL",async,"uname","pswd")

Specifies the method, URL, and other optional attributes of a request

The method parameter can have a value of "GET", "POST", or "PUT" (use "GET" when requesting data and use "POST" when sending data (especially if the length of the data is greater than 512 bytes.

The URL parameter may be either a relative or complete URL.

The async parameter specifies whether the request should be handled asynchronously or not. true means that script processing carries on after the send() method, without waiting for a response. false means that the script waits for a response before continuing script processing

send(content) | Sends the request
setRequestHeader("label","value") | Adds a label/value pair to the http header to be sent

### Properties

Property | Description
--- | ---
onreadystatechange | An event handler for an event that fires at every state change

readyState

Returns the state of the object:

0 = uninitialized
1 = loading
2 = loaded
3 = interactive
4 = complete

responseText | Returns the response as a string
responseXML | Returns the response as XML. This property returns an XML document object, which can be examined and parsed using W3C DOM node tree methods and properties
status | Returns the status as a number (e.g. 404 for "Not Found" or 200 for "OK")
statusText | Returns the status as a string (e.g. "Not Found" or "OK")

From http://www.w3schools.com (Copyright Refsnes Data)