This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

responseText

Summary

Returns the text response entity body, a string representing the response entity body, which is the fragment of the entity body of the response received so far (if LOADING) or the complete entity body of the response (if DONE).

Property of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest

Syntax

Note: This property is read-only.

var result = element.responseText;

Return Value

Returns an object of type StringString

Examples

// receive data sent from the server

xhr.onreadystatechange = function(){
    if(xhr.readyState == 4){
        var responseText = xhr.responseText;
    }
}

Related specifications

W3C XMLHttpRequest Specification
W3C Working Draft

Attributions