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) 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 :)

<!DOCTYPE html>
  <meta charset="utf-8">
  <title>AJAX with JavaScript</title>
  <div id="main">
    <h1>AJAX with jQuery</h1>
  <div id="footer"></div>
  <script src="jquery.js"></script>
  <script src="app.js"></script>

1 Answer

Sean T. Unwin
Sean T. Unwin
28,690 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,690 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. :)