document.addEventListener("DOMContentLoaded", function () { const contentContainer = document.getElementById("content"); const loadContentButton = document.getElementById("load"); loadContentButton.addEventListener("click", function () { // Make a GET request to the CoinGecko API fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_vol=true&include_24hr_change=true') .then(response => response.json()) .then(data => { // Update the content container with the fetched data contentContainer.innerHTML = `

Bitcoin Price: $${data.bitcoin.usd}

`; }) .catch(error => console.error('Error:', error)); }); });