I am trying to load a JSON file via javascript. I have a place button in the HTML that executes the function script.js You have accidentally quoted the whole line here. The name and value of an object should be quoted separately from the property. Also mask duplicate quote character further down: The key name must have only one loadAJAX . But I'm getting an error on line 11
var items = JSON.parse (request.responseText); It says that
unexpected end of input I checked many times and found no solution on this.
function loaded xx () {var request; If (window.XMLHttpRequest) {request = new XMLHttpRequest (); } Else {request = new ActiveXObject ("Microsoft.XMLHTTP"); } Request.open ("GET", "data.json"); Request.onreadystatechange = function () {if ((request.status === 200) & amp; (request.readyState === 4)) {var items = JSON.parse (request.responseText); Var output = "& lt; ul & gt;"; (For var of objects) {output = = "
" Information: Older things for old things, like Food eve ".
Rewrite as "info": "Older colors for old things, like food eve".
"" info: "My mother likes."
info .
No comments:
Post a Comment