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 trialPrzemyslaw Chmiel
13,532 PointsMy code dosent work, serwer is on.
Hi Guys, i know is stupid but im looking on this code around 1h and I thing im find most off code issue, if something more are there wrong please help me. I even add the newest jquery script from CDN and still dosent work.
bellow is codes
$(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>';
});
statusHTML += '</ul>';
$('#employeeList').html(statusHTML);
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AJAX Office Status Widget</title>
<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/main.css">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="js/widget.js"></script>
</head>
<body>
<div class="grid-container centered">
<div class="grid-100">
<div class="contained">
<div class="grid-100">
<div class="heading">
<h1>Corporate Intranet</h1>
</div>
</div>
<section class="grid-70 main">
<h2>Lorem Ipsum Headline</h2>
<p>Lorem Ipsum</p>
<p>Lorem Impsum</p>
<p>Lorem ipsum....</p>
</section>
<aside class="grid-30 list">
<h2>Employee Office Status</h2>
<div id="employeeList">
</div>
</aside>
<footer class="grid-100">
<p>Copyright, The Intranet Corporation</p>
</footer>
</div>
</div>
</div>
</body>
</html>
2 Answers
Przemyslaw Chmiel
13,532 PointsI didn’t saw any error in console, console are clear, i network too, I even copy finished code from workspace and still doesn’t working.
Dhanuka Anushanga
13,347 PointsHey Przemyslaw Chmiel, I didn't see any error in your code. I also tried your code in my workspace and it worked.
Lucian Rotari
12,007 PointsLucian Rotari
12,007 PointsCan you show what error have you got?