I’m trying to build an ESG dashboard using an API that looks like this –
html output
Below is my script.js file code – I’m sure it has something to do with the results section, please help me out!
document.getElementById('bruh').onclick = async function fetchData() {
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': 'redacted for confidentiality',
'X-RapidAPI-Host': 'redacted for confidentiality'
}
};
const tick = document.getElementById("tickr").value;
var results = 'https://yahoo-finance127.p.rapidapi.com/esg-score/symb?=';
results=results.concat(tick);
results=results.concat('&symb=');
const url=results;
const res = await fetch(url, options);
const record = await res.json();
document.getElementById("environment").innerHTML = record.data.map(item => `<li>${environmentScore.fmt}</li>`).join('');
document.getElementById("social").innerHTML = record.data.map(item => `<li>${socialScore.fmt}</li>`).join('');
document.getElementById("governance").innerHTML = record.data.map(item => `<li>${governanceScore.fmt}</li>`).join('');
}