global.XMLHttpRequest

Kind: static class of global

new XMLHttpRequest()

The constructor initializes an XMLHttpRequest. It must be called before any other method calls.

xmlHttpRequest.responseURL

Unsupported

Kind: instance property of XMLHttpRequest Read only: true

xmlHttpRequest.readyState ⇒ int

Returns an unsigned short, the state of the request.

Kind: instance property of XMLHttpRequest Returns: int - returns the state of the XMLHttpRequest client. Read only: true

xmlHttpRequest.responseText ⇒ string

Returns a DOMString that contains the response to the request as text, or null if the request was unsuccessful or has not yet been sent.

Kind: instance property of XMLHttpRequest Returns: string - returns the received text response. Read only: true

xmlHttpRequest.responseXML ⇒ object

Returns the XML document that supports W3C DOM level2 specification. The XML document is constructed with received bytes using XMLHttpRequest.

Kind: instance property of XMLHttpRequest Returns: object - returns the XML document response. Throws:

Read only: true

xmlHttpRequest.response ⇒ string or ArrayBuffer or Blob or Object

Returns the response from the server in the type specified by responseType. Only valid after the load event fires.

Kind: instance property of XMLHttpRequest Returns: string or ArrayBuffer or Blob or Object - returns an ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, depending on the value of; XMLHttpRequest.responseType that contains the response entity body. Read only: true

xmlHttpRequest.status ⇒ string

Kind: instance property of XMLHttpRequest Returns: string - returns the HTTP status code received from the server. Read only: true

xmlHttpRequest.statusText ⇒ string

Kind: instance property of XMLHttpRequest Returns: string - returns the response's status message with regard to the HTTP status code received from the server. Read only: true

xmlHttpRequest.timeout

The number of milliseconds a request can take before automatically being terminated. The default value is 0, which means there is no timeout.

Kind: instance property of XMLHttpRequest

xmlHttpRequest.timeout

Terminates a request and a timeout event will be dispatched after the given time has passed.

Kind: instance property of XMLHttpRequest Throws:

Param Type Description
value number number of milliseconds a request can take automatically being terminated.

xmlHttpRequest.responseType ⇒ string

Kind: instance property of XMLHttpRequest Returns: string - returns a string taken from the XMLHttpRequestResponseType enum which specifies; what type of data the response contains.

xmlHttpRequest.responseType

Kind: instance property of XMLHttpRequest

Param Type Description
value string A string indicating the type of data contained in the response. This should be "arraybuffer", "blob", "document", "json" or "text".

xmlHttpRequest.withCredentials

Indicates whether to send cookies on a HTTP request. When the value is set to true, XMLHttpRequest sends cookies. Otherwise, cookies are not sent.

Kind: instance property of XMLHttpRequest

xmlHttpRequest.withCredentials

Kind: instance property of XMLHttpRequest Throws:

Param Type Default Description
[value] Boolean true whether to send cookies on a HTTP request.

xmlHttpRequest.upload ⇒ XMLHttpRequestEventUpload

If XMLHttpRequest has data in the body to upload, upload related event will be notified via XMLHttpRequest.upload.

Kind: instance property of XMLHttpRequest Returns: XMLHttpRequestEventUpload - returns XMLHttpRequestEventUpload object. Read only: true

xmlHttpRequest.abort()

Aborts the request if it has already been sent.

Kind: instance method of XMLHttpRequest

xmlHttpRequest.getAllResponseHeaders() ⇒ string

Returns sorted and combined response’s header list. Each header field is defined by a group of [lower cased name]": "[value]"\r\n". Combined value is separated by ", ".

Kind: instance method of XMLHttpRequest Returns: string - returns response’s header list. Read only: true

xmlHttpRequest.getResponseHeader(name) ⇒ string

Returns the matching value of the given field name in response's header. The search key value is case-insensitive

Kind: instance method of XMLHttpRequest Returns: string - returns the value of the given name in response's header list. Read only: true

Param Type Description
name string The name to search in response's header list.

xmlHttpRequest.open(method, url, [async], [user], [password])

Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest() instead. Self-signed certificates are not currently supported for HTTPS connections.

Kind: instance method of XMLHttpRequest

Param Type Default Description
method string The HTTP request method to use, such as "GET", "POST", "PUT", "DELETE", etc. Ignored for non-HTTP(S) URLs.
url string A DOMString representing the URL to send the request to.
[async] boolean true An optional Boolean parameter, defaulting to true, indicating whether or not to perform the operation asynchronously. If this value is false, the send() method does not return until the response is received. If true, notification of a completed transaction is provided using event listeners. This must be true if the multipart attribute is true, or an exception will be thrown.
[user] string null The optional user name to use for authentication purposes; by default, this is the null value.
[password] string null The optional password to use for authentication purposes; by default, this is the null value.

xmlHttpRequest.overrideMimeType(mimetype)

Use a MIME type other than the one provided by the server when interpreting the data being transferred in a request. If parsing the MIME type fails, "application/octet-stream" will be used to interpret the data.

Kind: instance method of XMLHttpRequest Throws:

Param Type Description
mimetype string MIME type Since Only UTF-8 is supported for charset of text encoding, MIME type’s parameters "charset" with other values than 'UTF-8' is not valid.

xmlHttpRequest.setRequestHeader(header, data)

Sets the value of an HTTP request header. You must call setRequestHeader()after open(), but before send().

Kind: instance method of XMLHttpRequest

Param Type Description
header string The name of the header whose value is to be set.
data string The value to set as the body of the header.

xmlHttpRequest.send([data])

Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent.

Kind: instance method of XMLHttpRequest

Param Type Default Description
[data] * A body of data to be sent in the XHR request. This can be: A Document, in which case it is serialized before being sent. A BodyInit, which can be a BufferSource, FormData (without nested files/Blobs), URLSearchParams, ReadableStream, or USVString object. If no value is specified for the body, a default value of null is used.

To send binary content (e.g. in file uploads), use an ArrayBufferView in conjunction with the send() method. Note: Sending binary data via Blob is not supported yet.

results matching ""

    No results matching ""