This page is not complete.

The read-only XMLHttpRequest property responseText returns the text received from a server following a request being sent.


var resultText = XMLHttpRequest.responseText;


A DOMString which contains either the textual data received using the XMLHttpRequest or null if the request failed or has not yet been sent by calling send().

While handling an asynchronous request, the value of responseText always has the current content received from the server, even if it's incomplete because the data has not been completely received yet.

You know the entire content has been received when the value of readyState becomes XMLHttpRequest.DONE (4), and status becomes 200 ("OK").


The XMLHttpRequest.responseType is not set to either the empty string or "text". Since the responseText property is only valid for text content, any other value is an error condition.


var xhr = new XMLHttpRequest();
xhr.open('GET', '/server', true);

// If specified, responseType must be empty string or "text"
xhr.responseType = 'text';

xhr.onload = function () {
    if (xhr.readyState === xhr.DONE) {
        if (xhr.status === 200) {



Specification Status Comment
XMLHttpRequest Living Standard WHATWG living standard

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
responseTextChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support Yes
Full support Yes
Notes Before IE 10, the value of XMLHttpRequest.responseText could be read only once the request was complete.
Opera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes


Full support  
Full support
See implementation notes.
See implementation notes.

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, mfuji09, dr-js, Sheppy, ExE-Boss, erikadoyle, jsx
Last updated by: mdnwebdocs-bot,