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

How to use APIs with JavaScript Forum

View Course

274 points
Picture
Submitted by
CsKgamers
almost 4 years ago

I get Error: Oops, try again. Did you console.log(xhr.status)?

I have this as the code and I still get an error:

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);

Oops, try again. Did you console.log(xhr.status)?
TypeError: Property 'log' of object # is not a function

Please help what am I doing wrong?


12 votes

permalink

I had the same problem, however fixed it by changing the url from http:// to https://.

Hope this fixes your problem :)

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

2 Comments

818c469255a2a6159a82b390245ada9b?s=140&d=retro Bjoern Distelberg over 2 years ago

Thanks, this fixed it for me after I got a 'network error'.

C94b3f2739d95710ad436ad68682575b?s=140&d=retro David Gibbs over 2 years ago

No problem. Glad it's fixed :)


2 votes

permalink

your code works

664 points
Ec582d7d1ed0319e20999f46459957a0?s=140&d=retro
Submitted by
Milad
almost 4 years ago


0 votes

permalink

I ended it and when I came back to the code it said:

console(xhr.statusText);

which I just added the .log and it worked.. weird.

274 points
Picture
Submitted by
CsKgamers
almost 4 years ago

2 Comments

53555d3b52f863e76d0009d6_361040035 Jordan Davis over 3 years ago

it worked for me. just follow hint. and boom you got it...

Picture Peter Fisher over 2 years ago

Switching to Chrome from Safari made this work.


0 votes

permalink

I have the same problem. :(

340 points
5445b8414f5fd2bf2236d676d48a600d?s=140&d=retro
Submitted by
Allveenoh
over 3 years ago


0 votes

permalink

Had the same issue. I switched to Chrome and it worked. I was using Mozilla. I have had this problem with Mozilla and Codeacademy a bunch of times with "console.log" functions not working even though the code is accurate everywhere else. Try switching to Chrome if you aren't already.

178 points
110198fa414b4f3b24ca7134c9e81d68?s=140&d=retro
Submitted by
WanderLife87
over 3 years ago


0 votes

permalink

Thanks. I was having the same issue. :)

92 points
530b3cf252f8632fda001bbf_820046654
Submitted by
Becca
over 3 years ago


0 votes

permalink

I am using Chrome and have the same problem.

277 points
Picture
Submitted by
Ramon Buzo
about 3 years ago


0 votes

permalink

Chrome, have the same issue

42 points
Ae9bbb89a052513ae759b3130a7ffc39?s=140&d=retro
Submitted by
Adam Grace
about 3 years ago


0 votes

permalink

I am using Chrome and got the same error. Refresh the page and then Send. Worked for me. :)

282 points
2c42cd0ec5fe6fcb1a6804c2a1fdfa69?s=140&d=retro
Submitted by
Snoogins
about 3 years ago