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 trial

JavaScript AJAX Basics (retiring) Programming AJAX Processing JSON Data

Nina Kozlova
Nina Kozlova
11,602 Points

employees.json file throws 404 both on treehouse and on go daddy servers. What gives?

Treehouse finally works! Thank you, guys for your help

Chris Shaw
Chris Shaw
26,676 Points

Hi Nina,

First and foremost, I have fixed your code formatting which you can learn more about at Posting Code to the Forum.

I have downloaded the files from the video and they are indeed incorrect as the data folder which should contain employees.json doesn't exist along with that file, I have however created a workspace using the Launch Workspace button on the video player and that works as the video suggests it should.

/cc Dave McFarland

Nina Kozlova
Nina Kozlova
11,602 Points

Chris, thank you for fixing the code. I have tried and tried and tried with Launch Workspaces. Problem 1: it doesn't even find widget.js for that matter (and yes, I have the

<script src="js/widget.js"></script>

in the html.) Problem 2: if we are taught these skills, shouldn't we be able to practice them 'for real', not tied to Work Spaces? That's what I am trying to do. I have tried putting a whole path to the file employees.json, which is on my go daddy server with

xhr.open('GET',  '..data/employees.json')

and in console it shows the complete path to the file, which is a correct direct path. The file is there, I have also tried uploading it directly to the server outside of any folder, with the same result.

Frustration is building up :-(

But I'll keep trying. Thank you for your assistance.

2 Answers

Wen Yao Zhang
Wen Yao Zhang
762 Points

eh, not sure if this helps, but if you are using chrome as browser, it will not work. Chrome does not allow local ajax files.

Dana Ng
Dana Ng
6,366 Points

Yup that was my problem, I was using Chrome, but once I used Firefox, it worked fine.

Billy Bellchambers
Billy Bellchambers
21,689 Points

Hi Nina,

To my understanding JSON can only be requested via a server and not through directly integrated documentation in the site doc's. As you seem to be requesting the information from the folder you've uploaded rather than specifying a server url which is why your hitting this error.

I believe this is mentioned in the videos on this process.

Though I cannot explain exactly how to resolve this I believe that's the issue your experiencing.

Hope that goes some way to help.

Nina Kozlova
Nina Kozlova
11,602 Points

Billy, you are quite right, thank you for reminding me. Indeed, it was mentioned in the video. But I tried http://... and the complete path to the file on the server as well, with the file bing in a folder, out of a folder - directly on the server. It still does not work, unfortunately. I wonder whether there should be something else added or changed on the server. GoDaddy left me with "There is something wrong with the json file". I don't know how something can be wrong with a simple list of objects, but that's all I got from them.

Thank you for your assistance, Billy.