This forum is now read-only. Please use our new forums at discuss.codecademy.com.

How to use APIs with JavaScript Forum

View Course

395 points
55e0df9851b8872e73000259_388304702
Submitted by
Tracy Alison King
about 2 years ago

What is wrong with my HTTP Code

Screenshot of question, code and error: http://cl.ly/image/3t0Z3Q3D401F

Here is the code I am attempting to execute:

var xhr = new XMLHttpRequest();

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

xhr.send();
// Add your code above this line!

console.log(xhr.status);
console.log(xhr.statusText);


17 votes

Best answer

permalink

Hello :)

This is a bug. As you may know, some time ago codecademy has moved fully to https protocol. I guess it is the cause of the problem.

Please try to use secure version of the link:

xhr.open("GET", "https://www.codecademy.com/", false);

2375 points
571828824b7f51f26c000619_875219903
Submitted by
Maciej Wiercioch
about 2 years ago

8 Comments

Acca95551023b8e3887a863808a61cb1?s=140&d=retro Vinnie420 about 2 years ago

this worked thanks

571828824b7f51f26c000619_875219903 Maciej Wiercioch about 2 years ago

Great! You're welcome :)

559c6dcae39efe6ee2000595_444191707 Jason Ruiz about 2 years ago

thank you so much, I've been searching this solution thanks again

571828824b7f51f26c000619_875219903 Maciej Wiercioch about 2 years ago

I'm happy it's helpful :)

5611308495e378ea51000018_385979275 omar_khayyam about 2 years ago

I had the same problem. When I changed to it to "https" it worked fine. This bug should be taken care of...

571828824b7f51f26c000619_875219903 Maciej Wiercioch about 2 years ago

Yes, you are right, but there are bugs that are with us for few years :) Be patient.

5611308495e378ea51000018_385979275 omar_khayyam about 2 years ago

Well at least there are dedicated guys like you who help others fix these bugs before an "official" solution :)

Picture Clinton Medbery about 2 years ago

It's not really a bug. It would literally take just updating the block to say https. It's not like you have to reprogam anything.