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 Add a callback

Ajajx Basics > jQuery and Ajax > Code Challenge - error in the code challenge instructions

The instructions state that the 2nd argument for the $.get() method is the callback error. This is wrong, as per the jQuery API documentation, which states:

jQuery.get( url [, data ] [, success ] [, dataType ] )

This error should be corrected :)

app.js
$.get("footer.html");
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>AJAX with JavaScript</title>
</head>
<body>
  <div id="main">
    <h1>AJAX with jQuery</h1>
  </div>
  <div id="footer"></div>
  <script src="jquery.js"></script>
  <script src="app.js"></script>
</body>
</html>

1 Answer

Sean T. Unwin
Sean T. Unwin
28,686 Points

When the other parameters are in square brackets it means they are optional, which means sometimes the callback is thrid, but other times (when there is no data parameter to be passed) it is second.

Good news is you're both right, depending upon the scenario. Bad news is the way the challenge is worded it makes appear as if the callback is second every time.

Thanks! I thought it was jarring, especially considering that in the video preceding the (apparently contradicting) challenge, Dave specifically states AND the quiz reinforces it in the same order that the .get method should accept the three arguments in that specific order.

Who can I contact so they make it clearer for future students?

Sean T. Unwin
Sean T. Unwin
28,686 Points

We can try to summon Dave McFarland and see if he has any thoughts on this. Alternatively, you could email him or support to voice your concerns. :)