Bug in 16. Requests (How to use APIs with JavaScript)


#1

Hi all;
I'm Learning How to use APIs with JavaScript

in lesson 16. Requests

I tried to use
xhr.open("GET", "http://www.codecademy.com/", false);
but i cannt pass to next lesson

so i tried to use "https" instead of "http" .. it works :slight_smile:
so please fix it in the web site

link :
https://www.codecademy.com/courses/javascript-beginner-en-EID4t/3/2?curriculum_id=5122e6f8b2cb8a8e97000a01#


#2

I hope they fix it too, sat here for 10 min going, "DA FUQ?!"


#3

I encountered the same issue. The instructions need to be updated to https


#4

I also experienced the same issue, in a way it gets you ready for the kind of things you'll encounter with real-world API's!


#5

I found the issue myself.

I had to change the async flag on the xhr.open to:

xhr.open("GET", "http://www.codecademy.com/", true);


#6

Hey y'all found answer on another post....

add s to http in url. :slight_smile:


#7

My code is correct, and no matter what I do, I can't pass this exercise. The same exact thing happens to me as well on exercise 5, except the error on that one says, "Oops, try again. Did you console.log(xhr.status)?" It puzzles me, because exercise 1 also requires the same code as these exercises, but it will pass me...


#8

I am experiencing the exact same issue! My code is identical to yours and I'm getting the same error. I am very sure I am setting the var xhr to XMLHttpRequest();

You are not alone @opticondude


#9

It seems to work for me now. I tired again after my courses started working again (might be because they added a new course)


#10

Hmm, still nothing for me: I suppose we will see how things go with time... :')


#11

Ha! solved it! THERE IS A TYPO IN THE DIRECTIONS!!!!

"Call open xhr and pass it three arguments: "GET" (the type of request you'd like to make), "https://www.codecademy.com/" (the URL), and false (this means the exercise will wait until it gets a response from the server)."

codecademy.

so, just spell the name of this site wrong and it should work


#12

I can’t believe they still haven’t fixed this.


#13

Hey, could you explain more? Spell the name of this site wrong and it should work??


#14

I still seem to be getting an incorrect error even with using “https” AND spelling the site name correctly. However, if I use my same code in a Firefox browser instead of Chrome, then the validator counts it as correct. This has happened to me in both lessons 5 and 16. Not totally game-breaking, but it might be something that could frustrate some users.


#15

It seems if you just change “console.log(xhr.statusText);” to “console.log(‘OK’);” then it’ll work.


#16

@netblaster17259 You were right. This is the code.

var xhr = new XMLHttpRequest();
xhr.open("GET", "https://www.codecademy.com/", false);
// Add your code below!
xhr.send();
console.log(xhr.status);
console.log("OK");

#17

I am finding that none of the above solutions work for me in Chrome. I switched over to IE and logged back in and resubmitted the code from the “hint” and now it will move onto the next lesson. This is beyond frustrating to try and figure out where you aren’t doing things properly, only it isn’t you doing anything improperly it is this site itself having issues.


#18

Just like less 5 in this same section, this “hack” worked.


#19

The learning environment of this course is no longer supported, please update to the supported course:

https://www.codecademy.com/learn/learn-javascript

or if you want to learn es6:

https://www.codecademy.com/learn/introduction-to-javascript

Sure, this work around works, but given the course is no longer supported, over time more bugs will come into the lessons.