XML Http Request response Type

Ashish Choudhary Ashish Choudhary

The XMLHttpRequest property responseType is an enumerated string value specifying the type of data contained in the response. It also lets the author change the response type. If an empty string is set as the value of responseType, the default value of "text" is used..


var type = XMLHttpRequest.responseType;

XMLHttpRequest.responseType = type;


A string taken from the XMLHttpRequestResponseType enum which specifies what type of data the response contains.

When setting responseType to a particular value, the author should make sure that the server is actually sending a response compatible with that format. If the server returns data that is not compatible with the responseType that was set, the value of response will be null.