Question
In the context of this exercise, what other types of responses does the XMLHttpRequest
API support?
Answer
The XMLHttpRequest
API supports several types of responses, which include the following:
"document"
, which can be a document of type HTML or XML.
"json"
, which stands for JavaScript Object Notation, which is a file format that is made to be more human-readable.
"text"
, which is an object of type DOMSTRING
which is a UTF-16 string.
"blob"
, which is a Blob
(Binary large object) which contains raw binary data and usually represents files. A Blob is immutable, or cannot be changed.
"arraybuffer"
, which is a JavaScript ArrayBuffer
which contains fixed-length raw binary data. An ArrayBuffer is mutable and can be changed.