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

How to use APIs with JavaScript Forum

View Course

707 points
53aaa971548c3591c20023fe_795664506
Submitted by
OskaRoska
about 4 years ago

I don't understand why this won't work???

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


1 vote

permalink

If you're still having issues with this, change the url to https://...

508 points
C94b3f2739d95710ad436ad68682575b?s=140&d=retro
Submitted by
David Gibbs
almost 2 years ago


0 votes

permalink

Check your spelling on line 6... Should be
console.log(xhr.statusText);

1401 points
51b25eb2631fe9e5a6001ad3_501832880
Submitted by
Jody Shipley
almost 4 years ago

2 Comments

Picture Morgan Polotan almost 4 years ago

good catch Jody but even after fixing the spelling error this code doesn't work :(

529603bdf10c6063e8001e80_564572369?awsaccesskeyid=akiajkz7qvqfd72xnj3q&expires=1498279106&signature=sa23ekahlr3i%2fy%2f6culjgokwsrs%3d Alex Amy over 3 years ago

hey ther


0 votes

permalink

Hi,

The following code works fine:

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

Carmen

22 points
Picture
Submitted by
Carmen Holotescu
over 3 years ago