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 Programming AJAX Programming AJAX Challenge

Display is showing undefined for all room numbers. What do I need to do to my code? I am calling rooms[i].name..

http://w.trhou.se/0vcvsp020f

I copied the code from the previous exercise as suggested and changed the code to refer to the rooms.json file. I also changed the classes to match the room's available status and am using the rooms[i].name.

2 Answers

Blaize Pennington
Blaize Pennington
13,878 Points

You are showing undefined because you are trying to open rooms[i].name. There is no key of name in the Json file. There is a key of room, so if you change that to rooms[i].room it fixes everything.