XMLHttpRequest Properties: response

By: Dusty Arlia
Published on Wednesday, November 05, 2014 at 6:24 PM
Last Updated on Sunday, July 19, 2015 at 10:27 AM
Total Updates: 2

The response property of the XMLHttpRequest JavaScript object holds the HTTP server response.

The value of this property has a data type dependant on the responseType property. If responseType's value is an empty string or the string literal "text", then the response property will hold the value of the HTTP response as a string. If responseType's value is "document", then response's value will be a parsed representation of the HTTP response body as an XML or HTML document. If responseType has the value "arraybuffer", response will have an ArrayBuffer object as its value. The ArrayBuffer represents the bytes of the response body. And finally, if the responseType has the string literal "blob" as its value, then response's value will be a Blob object. This blob will represent the bytes of the response body.