I am having trouble setting the XHR responseType to "json". It works fine if I leave it an empty string xml.responseType = "";
but when I set it to "json" I get the console error message SYNTAX_ERR: DOM Exception 12.
The .js file:
var xml = new XMLHttpRequest();
xml.open("GET", "test.php", true);
xml.responseType = "json";
xml.send();
The .php file:
<?php
$foo = "{\"key1\":\"val1\", \"key2\":\"val2\"}";
echo $foo;
?>
Not sure what's going on.. Any ideas?