Skip to content Skip to sidebar Skip to footer

Xmlhttprequest To String

I'm trying to make a function that sends an XMLHttpRequest and return a string with the contents of the response, but it always returns null. How do I fix this? Code: function get

Solution 1:

If you are using Internet Explorer, at least, then you may have a null response because the ContentType header in the response is missing or incorrect. Quoting Microsoft's documentation on the responseXML property:

If the ... Multipurpose Internet Mail Extension (MIME) type was not correctly set to one of the supported MIME types ... then responseXML will be empty.

The supported MIME types for MSXML 6.0 are: "text/xml", "application/xml" or anything that ends with "+xml", for example "application/rss+xml".

The supported MIME types for versions prior to MSXML 6.0 are: "text/xml", "application/xml".

Post a Comment for "Xmlhttprequest To String"