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) jQuery and AJAX The Office Status Project Revisited

4,236 Points

Employee lists appends to the correct div but the in and out flags are now showing

Hello: I'm following along in the Office Status Project.

I can't figure out what's going wrong here and the console isn't giving me any errors.

  1. Employee List appears on the page
  2. The elements were correctly appended to the parent div
  3. The correct In/out classes are showing in the console.
  4. But the corresponding "In" and "Out" flags do not appear

Any help would be appreciated. Thanks!

in widget.js:

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


And here's a screenshot:


2 Answers

Collin Halliday
Collin Halliday
Full Stack JavaScript Techdegree Student 17,491 Points

Hey alee2,

You are very close. It looks like you just forgot to include an assignment operator(=) for your class declaration on the following line: "var statusHTML = '<ul class"bulleted">';" The line should read as follows: "var statusHTML = '<ul class="bulleted">';".

I hope that helps. Best of luck!

4,236 Points

Sorry, just saw this! Thanks for your help on this Collin Halliday. I figured it out...silly mistake.