in reply to Re: Sending file as "TEXT" or "BLOB"
in thread Sending file as "TEXT" or "BLOB"
Regarding XMLHttpRequest.responseType, and me not being a JavaScript expert at all but just a user, it looks to be a way to tell the XHR how to decode the received data in order to produce a native JS object. So setting xhr.responseType = 'json'; prior to the request, on completion of the request and receive of server data one can simply do var responseObj = xhr.response; If it's an array, JSON, blob or text, the XHR object will do the conversion for you. If one does not want to use this feature or plans to receive data which is not decodable by XHR (i.e. let's say it's hashed or encrypted) then use your standard decoder var responseObj = myDecoder(xhr.responseText); In my case (JSON data) that decoder is JSON.parse()
That also explains why yes, there is a json http header but there is none for some of the other supported XHR types *specifically*, e.g. ArrayBuffer
bw, bliako
|
|---|