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 trialJa'Nel Johnson
10,314 PointsI don't know what I'm doing wrong. Can someone please help?
Challenge: When the AJAX response fails, we should alert the user. Pop up an alert box with the XHR object's statusText property.
I thought I entered the correct code.
$.get("missing.html", function(data) {
$("#footer").html(data);
}).fail(function(jqHR){
alert(jqXHR.statusText);
});
<!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>
2 Answers
Grace Kelly
33,990 PointsHi Ja'Nel, you have simply misspelled "jqXHR" as "jqHR" in your parameter for the function, if you correct that mistake your code will run fine :) hope that helps!!
Ja'Nel Johnson
10,314 PointsThank you! I ended up figuring it out.
Grace Kelly
33,990 Pointsawesome stuff :D