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

How to use APIs with JavaScript Forum

View Course

752 points
541205f07c82ca8c3e0006d0_207123532
Submitted by
Cas Hutten
almost 2 years ago

why do I get "Error: Access denied"?

Hello, I just started on "How to use APIs with JavaScript" and at the first lesson, when you are supposed to get "OK" but instead I get "Error: Access denied". But Codecademy just let met go to the next lesson. What can be the cause of this?

pre-filled code of codecademy
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/", false);
xhr.send();

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

2 votes

permalink

I am not sure if these lessons have been updated. Apparently, the requests should be made to https://www.codecademy.com not http://...

Try that and you should get a status and status text from the site.

938 points
58a408ad85558fc9bd2daba887f0d1ed?s=140&d=retro
Submitted by
curleypg
almost 2 years ago

1 Comment

541205f07c82ca8c3e0006d0_207123532 Cas Hutten almost 2 years ago

Thank you, this worked for me!