XMLHttpRequest
Use XMLHttpRequest (XHR) objects to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing.
Documentation XMLHttpRequest by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Static Members
UNSENT: IntOPENED: IntHEADERS_RECEIVED: IntLOADING: IntDONE: IntInstance Members
onreadystatechange: haxe.FunctionAn EventHandler that is called whenever the readyState attribute changes.
readyState: IntReturns an unsigned short, the state of the request.
timeout: IntIs an unsigned long representing the number of milliseconds a request can take before automatically being terminated.
withCredentials: BoolIs a Boolean that indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers.
upload: XMLHttpRequestUploadIs an XMLHttpRequestUpload, representing the upload process.
responseURL: StringReturns the serialized URL of the response or the empty string if the URL is null.
status: IntReturns an unsigned short with the status of the response of the request.
statusText: StringReturns a DOMString containing the response string returned by the HTTP server. Unlike XMLHTTPRequest.status, this includes the entire text of the response message ("200 OK", for example).
responseType: XMLHttpRequestResponseTypeIs an enumerated value that defines the response type.
response: DynamicReturns an ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, depending on the value of XMLHttpRequest.responseType. that contains the response entity body.
responseText: StringReturns a DOMString that contains the response to the request as text, or null if the request was unsuccessful or has not yet been sent.
responseXML: HTMLDocumentReturns a Document containing the response to the request, or null if the request was unsuccessful, has not yet been sent, or cannot be parsed as XML or HTML.
Initializes a request. This method is to be used from JavaScript code; to initialize a request from native code, use openRequest() instead.
| Name | Type | Default |
|---|---|---|
method |
String | |
url |
String | |
async |
Bool | |
user |
String | (optional) |
password |
String | (optional) |
Sets the value of an HTTP request header. You must call setRequestHeader()after open(), but before send().
| Name | Type |
|---|---|
header |
String |
value |
String |
send(?body: HTMLDocument): VoidSends the request. If the request is asynchronous (which is the default), this method returns as soon as the request is sent.
| Name | Type | Default |
|---|---|---|
body |
HTMLDocument | (optional) |
abort(): VoidAborts the request if it has already been sent.
Returns the string containing the text of the specified header, or null if either the response has not yet been received or the header doesn't exist in the response.
| Name | Type |
|---|---|
header |
String |
| Returns |
|---|
| String |
getAllResponseHeaders(): StringReturns all the response headers, separated by CRLF, as a string, or null if no response has been received.
| Returns |
|---|
| String |
Overrides the MIME type returned by the server.
| Name | Type |
|---|---|
mime |
String |
| Name | Type |
|---|---|
ignored |
String |