Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript AJAX Basics (retiring) Programming AJAX Stage 2 Challenge

Tristan Terry
Tristan Terry
9,044 Points

Everything is working except my code is all showing up as false, what am I missing?

var xhrRoom = new XMLHttpRequest();
xhrRoom.onreadystatechange = function () {
  if(xhrRoom.readyState === 4 && xhrRoom.status === 200) {
    var rooms = JSON.parse(xhrRoom.responseText);
    var statusHTML2 = '<ul class="rooms">';
    for (var j=0; j<rooms.length; j += 1) {
      if (rooms[j].avaliable === true) {
        statusHTML2 += '<li class="empty">';
      } else {
        statusHTML2 += '<li class="full">';
      statusHTML2 += rooms[j].room;
      statusHTML2 += '</li>';
    statusHTML2 += '</ul>';
    document.getElementById('roomList').innerHTML = statusHTML2;
xhrRoom.open('GET', '../data/rooms.json');

So the styling seems to only be converting what is in my else statement.

Tristan Terry
Tristan Terry
9,044 Points

How about try spell check :P I mispelled available woot woot!

Rishit Shah
Rishit Shah
4,975 Points

you have misspelled the word "available". You have written if (rooms[j].avaliable === true) instead of if (rooms[j].available === true). Change it and your code should work fine. Please tell me if it still doesn't work.