I'm getting these errors and I'm not sure what I'm doing wrong.
I'm new to making http requests using Javascript and I was wondering what I'm doing wrong in my request. If anyone can take a look and explain it to me, or point me to an already accepted answer, it would be greatly appreciated.
window.addEventListener("load", function(){
let url = "https://api.guildwars2.com";
let method = "GET";
let async = true;
let getData = "Get Data";
let request = new XMLHttpRequest();
request.onreadystatechange = function(){
let status = request.readyState;
let data = request.responseText;
if(status == 4 && status == 200){
console.log("Connection made");
}
}
request.open(method, url, async);
request.send();
console.log(request);
})
Since this question has a very detailed answer already elsewhere, I'm closing it.