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 Handling Errors

jqHR vs jqXHR??

I was doing the code challenges after this and found that I had to use jqHR to get it too pass. Why is this? Updated?

2 Answers

While the instructions for step 2 says to use name jqXHR for the parameter in your callback function for the fail event, I found it accepted whatever name I gave it. Which makes sense, since you could declare that variable to be whatever you want when working in javascript. In step 3, you need to use the same variable name as you did setting up the function - otherwise you're calling a null object.

these will both work:



but the following won't:


This wasn't the case for me. In the AJAX documentation I can't find any reference to jqHR.

because though jqXHR is an object, jqHR is a name that you can give that object. Analogous to how there is a human, so it's not wrong to refer to it as a human, but then you can also name it Jack.