我在学习JavaScript,并且不断收到错误“未捕获的SyntaxError:JSON在位置0的JSON.parse处出现意外的标记u”。未捕获的SyntaxError:JSON中的位置0处的意外标记u在JSON.parse
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', 'https://learnwebcode.github.io/json-example/animals-1.json');
ourRequest.onload = function(){
var ourData = JSON.parse(ourRequest.resoponseText);
console.log(ourData[0]);
};
ourRequest.send();
它看起来像你有一个错字,我想它应该是'responseText'。 –