Hi,
I’m trying to learn how to use API’s, as a starter project I have decided to try and use EA’s FUT API.
The code I have is:
var searchInput = document.getElementById("userInput").value;
futSearchResult();
function futSearchResult() {
var request = new XMLHttpRequest();
request.open('GET', 'https://www.easports.com/fifa/ultimate-team/api/fut/item?name=' + searchInput.value, true);
request.onload = function () {
var data = JSON.parse(this.response);
if (request.status >= 200 && request.status < 400) {
console.log(commonName);
});
} else {
console.log('error');
}
}
};
};
request.send();
Could anyone please advise where I’m going wrong with this please?
Thanks