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 trialSean Flanagan
33,235 PointsWhat'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:
Thanks in advance.
Sean
Justin Deardorff
8,448 PointsI don't see your widget.js file in the workspace
Sean Flanagan
33,235 PointsJustin 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
3,477 PointsI 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
11,314 PointsHi 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
33,235 PointsHi guys. Thanks for your help. It works now.
Sean
Megan Oliver
Front End Web Development Techdegree Graduate 20,985 PointsMegan Oliver
Front End Web Development Techdegree Graduate 20,985 PointsOne 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.