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

How to use APIs with JavaScript Forum

View Course

434 points
Submitted by
almost 2 years ago

Whats wrong with my answer 5/19

var xhr = new XMLHttpRequest();"GET", "", false);
// Add your code below!
console.log (xhr.status) ;
console.log (xhr.statusText) ;

20 votes


Add an 's' after 'http' in your codecademy URL.

607 points
Submitted by
almost 2 years ago


55b0c6c9d3292fe1a200042e_597700130 Gabriel Checchia Vitali almost 2 years ago

Thank you! It worked for me!

557cf6db9113cb0ef6000060_726972838 thebrightobvious almost 2 years ago

Exercise 1 already has "http" written in, not "https". Clicking "submit" results in passing the level but doesn't print "200" or "OK" to the console. Seems like an error in the instructions.

55b44964e39efe2b2b0000cf_208709394 Taylor Palmer almost 2 years ago

Had the same problem. That's pretty dumb.

20f07c51b1b53277eba315b8e3ad0360?s=140&d=retro batraaf almost 2 years ago

Thanks, this solved it!

84d2a778ceda00652dffacf5ec1a20b3?s=140&d=retro Natalie Harzic almost 2 years ago

That really helped. It definitely should be fixed as the hint text suggests that an error was made in typing the required code and not that some existing code is already wrong. Thanks for the help.

Picture Mark Gould almost 2 years ago

Any reason why there is an s included here?

522b8c0df10c60ae650034d2_394003798 Daniel Lobo almost 2 years ago

Same here. Thanks it worked.

Picture AshTube almost 2 years ago

Mark, it's because the site now loads over a HTTPS connection, but the tutorial was written when it loaded over http, so the URL being requested for the API is incorrect, and the code therefore doesn't work.

-2 votes


When you open developer console, there is a reason:
Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ''. This request has been blocked; the content must be served over HTTPS.

HTTPS, hypertext transfer protocol secure, is HTTP through a secured connection. If you want to know more about it, check this article:

854 points
Submitted by
Sarah Kwak
almost 2 years ago