Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Lewis Turner
Lewis Turner
10,930 Points

Failed to load resource: the server responded with a status of 404 (Not Found)

Hi

I am getting the above error in workspaces. I have checked and re-checked my code but I can't figure out what is causing it...

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
    var employees = JSON.parse(xhr.responseText);
   }
};
xhr.open('GET', 'data/employees.json');
xhr.send();

https://teamtreehouse.com/workspaces/16510372#

Any help would be much appreciated!

Cheers

Lewis

Lewis Turner
Lewis Turner
10,930 Points

Aah, thats annoying. It works for me :(

This is my code...

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
    var employees = JSON.parse(xhr.responseText);
   }
};
xhr.open('GET', 'data/employees.json');
xhr.send();

2 Answers

Lewis Turner
Lewis Turner
10,930 Points

Crisis averted. I deleted the workspace, loaded it up again, pasted my js back in and re-added the script tag, and it worked. Workspaces was obviously having a bit of a moment! :o)

Lewis Turner
Lewis Turner
10,930 Points

Me either. I was well and truly stuck!