baseddata.io/layouts/shortcodes/bitcoin-price.html

20 lines
526 B
HTML
Raw Normal View History

2024-08-01 14:06:16 +01:00
<!doctype html>
<html>
<body>
<p id="price"></p>
<script>
fetch("https://api.bitlab21.com/price")
.then((response) => response.json())
.then((data) => {
var lastElement = data[data.length - 1];
document.getElementById("price").innerHTML =
`The current price is: <em>$ ${lastElement.price.toLocaleString()}</em> (${lastElement.date}) `;
})
.catch((error) => {
console.error("Error:", error);
});
</script>
</body>
</html>