XMLHttpRequest
-
- new XMLHttpRequest()
- .responseURL
- .readyState
- .responseText
- .responseXML
- .response
- .status
- .statusText
- .timeout
- .timeout
- .responseType
- .responseType
- .withCredentials
- .withCredentials
- .upload
- .abort()
- .getAllResponseHeaders()
- .getResponseHeader(name)
- .open(method, url, [async], [user], [password])
- .overrideMimeType(mimetype)
- .setRequestHeader(header, data)
- .send([data])
new XMLHttpRequest()
The constructor initializes an XMLHttpRequest. It must be called before any other method calls.
xmlHttpRequest.responseURL
Unsupported
Read only
xmlHttpRequest.readyState
Returns an unsigned short, the state of the request.
Returns: int - returns the state of the XMLHttpRequest client.
Read only
xmlHttpRequest.responseText
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.
Returns: string - returns the received text response.
Read only
xmlHttpRequest.responseXML
Returns the XML document that supports W3C DOM level2 specification. The XML document is constructed with received bytes using XMLHttpRequest.
Returns: object - returns the XML document response.
Throws:
DOMExceptionif responseType is not the empty string or "document".
Read only
xmlHttpRequest.response
Returns the response from the server in the type specified by responseType. Only valid after the load event fires.
Returns: string | ArrayBuffer | Blob | 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
xmlHttpRequest.status
Returns: string - returns the HTTP status code received from the server.
Read only
xmlHttpRequest.statusText
Returns: string - returns the response's status message with regard to the HTTP status code received from the server.
Read only
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.
xmlHttpRequest.timeout
Terminates a request and a timeout event will be dispatched after the given time has passed.
Throws:
DOMExceptionif called for synchronous request.
numberxmlHttpRequest.responseType
Returns: string - returns a string taken from the XMLHttpRequestResponseType enum which specifies; what type of data the response contains.
xmlHttpRequest.responseType
stringxmlHttpRequest.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.
xmlHttpRequest.withCredentials
Throws:
DOMExceptionwhen set if state is not unsent or opened.
BooleantruexmlHttpRequest.upload
If XMLHttpRequest has data in the body to upload, upload related event will be notified via XMLHttpRequest.upload.
Returns: XMLHttpRequestEventUpload - returns XMLHttpRequestEventUpload object.
Read only
xmlHttpRequest.abort()
Aborts the request if it has already been sent.
xmlHttpRequest.getAllResponseHeaders()
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 ", ".
Returns: string - returns response’s header list.
Read only
xmlHttpRequest.getResponseHeader(name)
Returns the matching value of the given field name in response's header. The search key value is case-insensitive
Returns: string - returns the value of the given name in response's header list.
Read only
stringxmlHttpRequest.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.
stringstringbooleantruestringnullstringnullxmlHttpRequest.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.
Throws:
DOMExceptionif state is loading or done
stringxmlHttpRequest.setRequestHeader(header, data)
Sets the value of an HTTP request header. You must call setRequestHeader()after open(), but before send().
stringstringxmlHttpRequest.send([data])
Sends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent.
\*