目录

Network Request

Creating a Network Request Object

var xmlHttp = new XMLHttpRequest();

The XMLHttpRequest object provides full access to HTTP, allowing you to send POST and HEAD requests, as well as standard GET requests. The XMLHttpRequest object can synchronously or asynchronously return a response from the web server in the form of text or a DOM document.

Definition

API

Description

XMLHttpRequest.onreadystatechange = callBack

Specifies the response processing function.

XMLHttpRequest.open(method, url, async, username, password)

Initializes HTTP request parameters.

XMLHttpRequest.setRequestHeader(name, value)

Sets the request header.

XMLHttpRequest.send(body)

Sends an HTTP request using the parameters passed to the open() method and an optional request body passed to the send method.

XMLHttpRequest.getAllResponseHeader()

Returns all response headers.

XMLHttpRequest.getResponseHeader(header)

Returns the value of the specified HTTP response header.

XMLHttpRequest.abort()

Cancels the current request.

XMLHttpRequest.responseText

Returns the response body (excluding the headers) received by the server so far, or an empty string if no data has been received.

XMLHttpRequest.responseXML

Returns a Document object containing the XML retrieved by the request.

XMLHttpRequest.status

Parses the response into XML and returns the result as a Document object.

XMLHttpRequest.statusText

Returns the HTTP status code of a request.

XMLHttpRequest.readyState

Describes the status of an HTTP request.

XMLHttpRequest.response

Returns an ArrayBuffer, Blob, Document, or DOMString, depending on the value of XMLHttpRequest.responseType.

XMLHttpRequest.responseType

Defines enumerated values of the response type.

XMLHttpRequest.responseURL

Returns a serialized response URL. If the URL is empty, an empty string is returned.

XMLHttpRequest.timeout

Returns an unsigned long integer representing the maximum time, in milliseconds, that the request is allowed to take. If this time is exceeded, the request is automatically terminated.

XMLHttpRequest.withCredentials

Returns a boolean value, indicating whether the cross-domain Access-Control request should contain authorization information, such as cookies or authorization headers.

XMLHttpRequest.overrideMimeType

Overrides the MIME type returned by the server.

[h2]XMLHttpRequest.onreadystatechange = callBack

[h2]XMLHttpRequest.open(method, url, async, username, password)

[h2]XMLHttpRequest.setRequestHeader(name, value)

[h2]XMLHttpRequest.send(body)

[h2]XMLHttpRequest.getAllResponseHeader()

[h2]XMLHttpRequest.getResponseHeader(header)

[h2]XMLHttpRequest.abort()

[h2]XMLHttpRequest.responseText

[h2]XMLHttpRequest.responseXML

[h2]XMLHttpRequest.status

[h2]XMLHttpRequest.statusText

[h2]XMLHttpRequest.readyState

[h2]XMLHttpRequest.response

[h2]XMLHttpRequest.responseType

[h2]XMLHttpRequest.responseURL

[h2]XMLHttpRequest.timeout

[h2]XMLHttpRequest.withCredentials

[h2]XMLHttpRequest.overrideMimeType