I'm currently attempting to make a straightforward JSON call, however, I'm encountering difficulty accessing the JSON file. The console is displaying the following error message: "Uncaught SyntaxError: Unexpected token u"
Here is a snippet from my 'universe.json' file:
{"menu": {
"key": "value",
"object": {
"sub_object": [
{"key": "value", "key2": "value2"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
Furthermore, this is the content of my JS file:
$(document).ready(function(){
var request = new XMLHttpRequest();
request.open('GET','universe.json',true);
request.responseType = 'JSON';
request.onload = function() {
data = JSON.parse(this['menu']);
console.log('yes');
};
request.send();
});
Any guidance or assistance would be greatly appreciated. Thank you.