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

The Office Status Project Revisited code not working

looks like a problem with widget.js.5, but I can't see what it is. https://w.trhou.se/fknc0s8esl

1 Answer

Maybe try this. Delete the letter s. What happened?

$.each(response, function (index, employee)

No. The code still isn't working. ☹️

If you don't use url variable and put the url path inside the getJSON?

$(document).ready(function () {
  $.getJSON("../data/employees.json" function (reponse) {
    var statusHTML = '<ul class="bulleted">';
   $.each(response, 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
}); //end ready