FAQ: Requests I - XHR GET Requests II

This community-built FAQ covers the “XHR GET Requests II” exercise from the lesson “Requests I”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise XHR GET Requests II

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi everyone. I’m up to POST requests now but I’m struggling to understand the concept of requests. Is it so we can use information from other websites?

5 Likes

I also feel like I am not learning anything new with this lesson. This is not like the previous chapters in the course. Hopefully it will be explained more thoroughly as we go along.

2 Likes

I am curious why this function does not follow the usual Camel case syntax ?
xhr.onreadystatechange()

4 Likes

Why xhr.onreadystatechange function handler has to be an arrow syntax but not function expression?
Why this works?
xhr.onreadystatechange = () => {};
But this doesn’t

xhr.onreadystatechange = function() {
  
};
3 Likes

Hey guys I’m so confused the exercise only asked us to add a property responseType to the xhr object (task 3) but then asks us to return the response property of xhr (task 6). Shouldn’t it be responseType or am I missing something here?

This exercise is basically copy the text from the image we showed you two seconds ago without further explanation whatsoever. cmon guys.

2 Likes

I’m not doing so hot with this module BUT I think I can help here.

I believe the response TYPE determines the format of what is returned. In this case, a json file will be returned. The response should the file itself.

We are saying “hey, i need a repsonse in the form of a json file” and the server says “i gotchu, here ya go” and sets it equal to the response property for xhr?

1 Like

It would be helpful if someone indicated that this response is correct! Or not - but that would require further explanation :slight_smile:

1 Like

Why is onreadystatechange used instead of onload?