To brush up on my web development skills I am trying to re-learn API. I got the from this website: https://documenter.getpostman.com/view/10808728/SzS8rjbc?version=latest
In my JS file, I have the following code:
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.covid19api.com/summary", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
And I see that it logs a lot of data, but I'm not sure how to grab a specific data from the API and display it on the HTML page.
I tried something like this in the JS file:
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.covid19api.com/summary", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
let tdeaths = data.global.TotalDeaths;
document.getElementById('tdeaths').innerHTML = tdeaths.toLocaleString('en');
But nothing is showing up on my HTML file with