Draft
This page is not complete.
The XMLHttpRequest.response
property returns the response's body. It can be of the type ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, depending of the value of XMLHttpRequest.responseType property. Value of response
is null if the request is not complete or was not successful. However, if the value of responseType
was set to "text" or the empty string, response
can contain the partial text response while the request is still in the loading state.
Value of responseType |
Data type of response property |
"" |
DOMString (this is the default value) |
"arraybuffer" |
ArrayBuffer |
"blob" |
Blob |
"document" |
Document |
"json" |
JavaScript object, parsed from a JSON string returned by the server |
"text" |
DOMString |
"moz-blob" |
Used by Firefox to allow retrieving partial Blob data from progress events. This lets your progress event handler start processing data while it's still being received. |
"moz-chunked-text" |
Similar to When This mode currently only works in Firefox. |
"moz-chunked-arraybuffer" |
Similar to When This mode currently only works in Firefox. |
"ms-stream" | Indicates that the response is part of a streaming download. It is supported only for download requests. This mode is available only in Internet Explorer. |
Note: Starting with Gecko 11.0 (Firefox 11.0 / Thunderbird 11.0 / SeaMonkey 2.8), as well as WebKit build 528, these browsers no longer let you use the responseType
attribute when performing synchronous requests. Attempting to do so throws an NS_ERROR_DOM_INVALID_ACCESS_ERR
exception. This change has been proposed to the W3C for standardization.
Example
// Example should go here
Specifications
Specification | Status | Comment |
---|---|---|
XMLHttpRequest | Living Standard | WHATWG living standard |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | ? | ? |