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

Error in jquery-1.11.0.min.js itself.

When I load the page I get the following error in my JavaScript console:

Uncaught TypeError: Illegal constructor jquery-1.11.0.min.js:2

Is there anything I can do to fix this? Am I just going have to wait for the people at JQuery to correct the error?

Christian Hals
Christian Hals
11,811 Points

I was having a similar problem as you and it was killing me. I looked over my code countless times without finding the error. After debugging it turns out I had types reponse in stead of response. If you for instance type $(Document).ready in stead of $(document).ready you will get the "Illegal constructor jquery-1.11.0.min.js:2" error message.

This is my working code snippet for 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>";
      });
      statusHTML += "</ul>";
      $("#employeeList").html(statusHTML);
    }); //end getJSON
}); //end ready

Hope this works for you.

3 Answers

Tnx guys :) It was an $(Document).ready instead of $(document).ready as Christian Hals did mention. I started commenting out my HTML and found it was in the widget.js file and code, sure enough the $(Document).ready was on the first line. I changed it to the proper $(document).ready and the code ran perfectly.

Karolin Rafalski
Karolin Rafalski
11,368 Points

Do you have any js or jQuery code? Sometimes you'll get an error message if you have an incorrect number of {} or () or maybe even from missing a ;, or another typo.

What are you referring to of me having any js or jQuery code? I have been adding JavaScrip code in the widget.js file in the workspace following along with the lession. The error is in the jquery-1.11.0.min.js file that is downloaded from code.jquery.com itself.

Hi, tallwes, You don't need to download nothing. In the index.html, after the: <link rel="stylesheet" href="css/main.css"> You need to add the file: <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> This is the best and fastest way. Have fun :)