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 Stage 3 Challenge Answer

Sean Flanagan
Sean Flanagan
33,235 Points

What's the difference between my code and Dave's?

Hi.

I could do with some constructive feedback.

For example, I copied and pasted the whole method whereas Dave didn't copy the first line.

Here's my workspace:

https://w.trhou.se/rpwcjekqh9

Thanks in advance.

Sean

Megan Oliver
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Megan Oliver
Front End Web Development Techdegree Graduate 20,985 Points

One mistake is that you should be using the classes "full" and "empty" for the rooms, not "available" and "unavailable". If you scroll through the CSS file you'll see the styling in there.

Justin Deardorff
Justin Deardorff
8,448 Points

I don't see your widget.js file in the workspace

Sean Flanagan
Sean Flanagan
33,235 Points

Justin Deardorff If you click on the js folder, you'll find my widget.js in there.

Megan Oliver I understand.

Thank you both.

3 Answers

Mark Lisher
Mark Lisher
3,477 Points

I also see these issues:

var statusHTML = '<ul class="bulleted">'; "bulleted" should be "rooms"

statusHTML += room.name + '</li>'; .name should be .room (look in the rooms.json file)

Adam Beer
Adam Beer
11,314 Points

Hi Sean! Please look at my solution.

$(document).ready(function () { $.getJSON('../data/rooms.json', function (data) { var statusHTML = '<ul class="rooms">'; $.each(data,function (index, room) { if (room.available === true) { statusHTML +='<li class="empty">'; } else { statusHTML +='<li class="full">'; } statusHTML += room.room + '</li>'; }); statusHTML += '</ul>'; $('#roomList').html(statusHTML) }); // end getJSON }); // end ready

Sean Flanagan
Sean Flanagan
33,235 Points

Hi guys. Thanks for your help. It works now.

Sean