Being new to AJAX, I have encountered an issue that I believe others may have faced as well. Despite numerous attempts and extensive research, I am unable to find a solution to this error. I am confident that it is something simple. Any help would be greatly appreciated.
// defining variable for JSON request
var request = new XMLHttpRequest();
// initiating GET request for specified JSON URL
request.open('GET', 'http://api.fixer.io/latest');
ourRequest.onload = function () {
var data = JSON.parse(request.responseText);
console.log(data[1]);
};
request.send();