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

How to use APIs with JavaScript Forum

View Course » View Exercise

302 points
Cbad1f5d08c926c989b698a8edb7bfb4?s=140&d=retro
Submitted by
boman98
over 3 years ago

why doesn´t this work

// Add your code below this line!
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);

why doesn´t this work?


6 votes

permalink

You capitalized the TTP in the XMLHttpRequest. This code worked for me
// Add your code below this line!
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);

688 points
08dbb5a41ceea369a608c8bba644119a?s=140&d=retro
Submitted by
carlf191
over 3 years ago

3 Comments

7045687a24afa06148ea79fcc3473c26?s=140&d=retro xCdacdmyX over 3 years ago

I copy pasted your code, and it worked. wth? I don't have TTP capitalised.

7045687a24afa06148ea79fcc3473c26?s=140&d=retro xCdacdmyX over 3 years ago

Found it - "www.codecademy.com" .
i had it as "www.codeacademy.com

52f67c5b548c35972d0037ef_190561216 Charlie about 3 years ago

Thanks for that answer. It really helped me.


2 votes

permalink

Nasty typo! Looks like codeacademy didn't get the domain name they wanted. I've been on codeacademy for a long time but never noticed the domain doesn't have an 'a' after 'code'.

1494 points
1b32f0cd4c80c542784f8e51760916ed?s=140&d=retro
Submitted by
varley
over 3 years ago

2 Comments

53985b968c1cccd3f6002077_456873061 Gabi Kuiper about 3 years ago

Well that's annoying

519a21821587e8cab3003030_337732662 77khondamir over 2 years ago

Lolol haha that's EXACTLY what happened with me xD


1 vote

permalink

i put codeAcademy... not codecademy.com lol

255 points
52e369c77c82ca80b8002e1a_733514328
Submitted by
Brandon Kris
over 3 years ago


0 votes

permalink

~I am having the same problem myself, I guess it is a bug.

198 points
523f452ef10c607af8007210_314963285
Submitted by
Bourne Excellensia
over 3 years ago


0 votes

permalink

It didn't work for me, even though I didn't capitalise it. I even did copy and paste

198 points
523f452ef10c607af8007210_314963285
Submitted by
Bourne Excellensia
over 3 years ago


0 votes

permalink

Same thing.

326 points
Picture
Submitted by
Andy Fang
over 3 years ago


0 votes

permalink

Yep, me too,

Screenshot

Edit: Found me mistake > "www.codeacademy.com" << I kept typing it wrong!

341 points
7045687a24afa06148ea79fcc3473c26?s=140&d=retro
Submitted by
xCdacdmyX
over 3 years ago


-5 votes

permalink

vote me up if you like ALIENS VS PREDATOR

286 points
537ccbea9c4e9de5870000ca_973792293
Submitted by
eduller0001
almost 3 years ago

5 Comments

537ccd73282ae37e12000116_993215480 mdeltoro0003 almost 3 years ago

Yah man this guy is so cool

537ccbea9c4e9de5870000ca_973792293 eduller0001 almost 3 years ago

THX MAN UR COOL TOO

537ccbea9c4e9de5870000ca_973792293 eduller0001 almost 3 years ago

lol

57bdf1af2524c84f0d0005ee_127965063 McKye Carter almost 3 years ago

This is highly irrelevant.

55c96525e39efe607a000784_727349661 Tr0j4n V1ru5 Coding almost 2 years ago

Screw this