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

What's the Question in Step 2??

Am I missing something? What is the second step asking for?

And please don't just repeat the question to me...

app.js
$('#footer').load('index.html');
$('#footer').load('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>

5 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Joshua Harman In the example you are showing, you select the #footer element two times -- you only select it once and then load the external HTML file. Chyno Deluxe's answer is correct.

$('#footer').load("footer.html");
Chase Marchione
Chase Marchione
155,055 Points

Hi Joshua,

First we'll select the footer. Second, we'll call the load method and supply it with the footer.html file that was specified in the challenge.

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

Hope this helps.

i tried that...

i also tried using '#main'

Thank you!!! it threw me off when the quiz, by default said

" Important: The code you write in each task should be added to the code written in the previous task."

I was seriously discourage because I thought that I had learned it wrong and didn't know what the problem was!