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

Widget not working properly.

I was experimenting with the $.ajax method so I decided to try and replace some code in an earlier challenge with that instead of the $.getJSON method, it actually prints on screen but almost looks like a cross between not being styled and being printed in plain html. I'm posting the JS file below any help is welcomed. Thank you in advance.

$(document).ready(function () {
  $.getJSON('../data/employees.json', function (data) {
    var statusHTML = '<ul class="bulleted">';
    $.each(data,function (index, employee) {
      if (employee.inoffice === true) {
        statusHTML +='<li class="in">';
      } else {
        statusHTML +='<li class="out">';
      }
      statusHTML += employee.name + '</li>';
    });
    statusHTML += '</ul>';
    $('#employeeList').html(statusHTML);
    }); // end getJSON
  });   


$(document).ready(function () {
  $.ajax({
    url: '../data/rooms.json',
    method: "GET",
    success: function (response) {
        var sHtml = "ul class='rooms'>";
      $.each(response, function (index, rooms) {
      if (rooms.available === true) {
        sHtml +='<li class="empty">';
      } else {
        sHtml +='<li class="full">';
      }
      sHtml += rooms.room + '</li>';
    });
      sHtml += "</ul>";
      $("#roomList").html(sHtml);
    }
  });
}); //end ready