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) jQuery and AJAX The Office Status Project Revisited

Andrei Punei
Andrei Punei
14,051 Points

How do you get the values from the JSON file??

The file is named employees.json altough in the callback function nested in the each method we used employee as defining the JSON file??

If you can provide employees.json so I can view how it's formatted I can supply a thorough expanation

1 Answer

Pedro Sousa
Pedro Sousa
Python Development Techdegree Student 18,546 Points

Hello Andrei,

I'm not 100% sure if I understood your question, but here's my try.

Did you noticed the data on the employees.json is an array? (everything is inside [ ]'s ).

Therefore, we are using query's .each function which takes an array, and a callback. You can name the parameters of the callback whatever you want.

For every position on the array, jQuery will call the callback and give it the current position to the first parameter and the current value to the second one.

Hope this helps.

Cheers, Pedro