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 AJAX Basics (retiring) Programming AJAX Processing JSON Data

Mohamoud Dandan
Mohamoud Dandan
7,133 Points

Why is my list of employees not populating?

please i need your help i do not know where is my error and here is my code var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if(xhr.readyState === 4) { var employees = JSON.parse(xhr.responseText); var statusHTML = '<ul class="bulleted">' for (var i=0; i<employees.lenght; i += 1) { if (employees[i].inoffice === true) { statusHTML += '<li class="in">'; }else{ statusHTML +='<li class="out">'; } statusHTML += employess[i].name; statusHTML +='</li>'; } statusHTML += '</ul>'; document.getElementById('employeeList').innerHTML = statusHTML; } };

xhr.open('GET', 'data/employees.json'); xhr.send();

Hi Mahamoud - Happy to help, but first could you display your code using the Markdown Cheatsheet (see link below) so that's formatted in a way for people to easily read?

Mohamoud Dandan
Mohamoud Dandan
7,133 Points

thank you guys I fixed the issue thank you all !!