API calls not working. But code is correct


#1

Hey guys I'm doing to the course on "How to use APIs with Javascript" and I'm on part 16 "Requests".

This is the code that I have written.

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

I have checked and double-checked my code, and it seems to be right. But the course won't let me continue. Do you guys see anything wrong?


#2

@currymanswag,

req.onreadystatechange = stateChange;
//Give it the keys specifying GET or POST
req.open("GET", url, true);
//Since we are using GET no info to send   <<<<<<=======
req.send("");

https://developer.mozilla.org/en-US/docs/AJAX


#3

@currymanswag,

Change the open() ARGUMENT
"http://www.codecademy.com/"
into
"https://www.codecademy.com/"