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

197 points
510849897e3becbdab0001e8_696087041
Submitted by
bm123
over 4 years ago

Can't seem to get the 'var' for xhr correct

Here's the code:
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/", false);
xhr.send(xhr);

can't get through this exercise...
thanks.


3 votes

permalink

TRY THIS,IT MAY WORK..
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/", false);
xhr.send();

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

1141 points
C9ab6bf78716096bc298c43a6890f629?s=140&d=retro
Submitted by
santosh88rb0103_50c0ba285ac38a2ae200
over 4 years ago


1 vote

permalink

I tryed this:
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/", false);
xhr.send(xhr);

and this:
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/", false);
xhr.send();

Both work fine for me. Try again, maybe it was temporary

2298 points
51c3137152f86344bb00a31c_304619310
Submitted by
Fatal Dose
over 4 years ago


1 vote

permalink

Oh, I see... it's CODECADEMY and NOT CODEACADEMY.... they misspelled their domain name, seems it should be Code Academy but instead it's Code Cademy.

195 points
09a0b731704ecf66f4cd52f257679d26?s=140&d=retro
Submitted by
Casey Trombley
over 4 years ago

4 Comments

Picture Sheamus Burns over 3 years ago

LOL!

5907fa2e58212277b80000b1_403915627 Thomas Gerot over 2 years ago

Actually, the name codecademy is intended. It is a pun (a play on words) on 'code' and 'academy' but they did not misspell their domain name, rather, you were unaware of the pun.

09a0b731704ecf66f4cd52f257679d26?s=140&d=retro Casey Trombley about 2 years ago

not really a pun, but thanks for your perspective Thomas, the folks at Code Cademy will be happy you were able to explain that

55c96525e39efe607a000784_727349661 Tr0j4n V1ru5 Coding almost 2 years ago

  • 100000

0 votes

permalink

// Add your code below this line!
var xhr = new XMLHttpRequest();
xhr.open("GET","http://www.codecademy.com",true);
xhr.send("----------.----------@gmail.com");

// Add your code above this line!

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

535 points
51bd876d7c82ca960d017e3a_107102458
Submitted by
Victor10
almost 4 years ago


-1 votes

permalink

I think that the xhr.send function is
xhr.send();

239 points
4e0f606aad7cc70a30e63cade77383fc?s=140&d=retro
Submitted by
Erin Hodgess
over 4 years ago

2 Comments

510849897e3becbdab0001e8_696087041 bm123 over 4 years ago

no luck
any other suggestions?

Ebc06de486276fa4d0f33b37afe2956c?s=140&d=retro Toni Lehtimäki over 4 years ago

Try different browser ie. Google Chrome or check that you wrote codecademy NOT codeacademy. :)