I can't seem to figure out why this code won't display the JSON requested. I've narrowed this down to the bare minimum and still having issues. Am I not doing the XMLHttpRequest properly?
<html>
<body>
<a id="testname"></a>
<a id="testval"></a>
</body>
<script>
var request = new XMLHttpRequest();
request.open('GET', 'test.json');
request.responseType = 'json';
request.send();
request.onload = function() {
var test = request.response;
document.getElementById("testname").innerHTML = test.name;
document.getElementById("testval").innerHTML = test.val;
};
</script>
</html>