When doing a 'GET' request, xhr.response
and xhr.responseText
both return the same value. What's the difference? Is there any?
The response
is interpreted into a ArrayBuffer
, Blob
, Document
, JavaScript object, or a DOMString
, depending on the value of XMLHttpRequest.responseType
. responseText
, on the other hand is the raw text, and you can handle it however you want. They are very similar in usage though.
response
when you get JSON from the server, and have it translated into a JavaScript object.responseText
when you don't own the server, and the responseType
is a format you don't want to use.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With