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 Use jQuery's .load() method

JQuery & AJAX Section Stage 3 - First Challenge - Error?

Challenge task 1 of 2 In the app.js file, use jQuery to select the footer div of the web page. Look at the index.html file to see how the HTML is structured.

Bummer! When selecting a page element with jQuery, pass a CSS selector to the $() method.

Code that I Included inside app.js

function sendAJAX() {
 $('#footer').load('footer.html');
}

I added <script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script> in head of index.html, near the footer of index.html and even in the top of app.js Nothing works and I am stumped!

5 Answers

Andrew Kiernan
Andrew Kiernan
26,892 Points

Hey Jann!

I like where your head's at keeping your code contained in a function, but I think that may be what is throwing off your answer. If you pull $('#footer').load('footer.html') out of your function and submit it that way it should work!

Let me know if you need anything else!

-Andrew

Erik Robles
Erik Robles
Courses Plus Student 10,635 Points

Yes. This one really stumped me to as I added everything. I didn't know they just wanted the guts of the function and not the whole function and its insides as well.

$('#footer').load('footer.html')

Thanks, Andrew. I guess I got ahead of the challenge there. That was the fix. Greatly Appreciated!

I'm stuck on the same chagllen I've tried everything I can think of and I can't pass it to save my life. Any chance you could help.

Andrew Kiernan
Andrew Kiernan
26,892 Points

Hey Anthony.

I'd be happy to help!

Assuming it is the exact same challenge, you want to use the $('#footer').load method above, but don't wrap it in any type of function or anything and it should pass.

If its a different issue, just post what it is and what you've tried and I'll give it my best shot.

-Andrew

That was a big help! Thanks I've been stressing at that for a few days! The questions are all easy they just don't word some of them as well as they could!

Thanks again! :)