MDN wants to learn about developers like you:


This page is not complete.

The XMLHttpRequest.responseText property 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. The responseText property will have the partial response as it arrives even before the request is complete. If responseType is set to anything other than the empty string or "text", accessing responseText will throw InvalidStateError exception.


var xhr = new XMLHttpRequest();'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

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? (Yes) ? ?[1] ? ?
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? (Yes) ? ? ? ?

[1] Before IE 10, the value of XMLHttpRequest.responseText could be read only once the request was complete.

Document Tags and Contributors

 Contributors to this page: erikadoyle, jsx
 Last updated by: erikadoyle,