Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialWendell Pulsipher
10,183 PointsUncaught SyntaxError: Unexpected token / ... widget.js line 5
here is my code... why am I getting this error
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(xhr.readyState === 4){
if(xhr.status === 200){
var info = JSON.parse(xhr.responseText);
}
}
}
xhr.open('GET', 'info.json');
xhr.send();
4 Answers
Dave McFarland
Treehouse TeacherSounds like the info.json file isn't a valid JSON file. Have you tried checking the info.json file in jsonlint,com to see if it validates?
Wendell Pulsipher
10,183 PointsDave McFarland I have to wonder... could it be a browser issue?
Wendell Pulsipher
10,183 PointsI really need help with this right away please.. i have a project to get done
Wendell Pulsipher
10,183 PointsI pasted it into the validator but it ran an error because of the comment in the info.json file, so I took out the comment and now it works fine. Thank you.