bpb-website/update.js
2025-06-25 20:26:01 -04:00

25 lines
713 B
JavaScript

document.addEventListener('DOMContentLoaded', () => {
const message = document.getElementById('message');
fetch('update.json')
.then(response => response.json())
.then(data => {
const update = data[0];
message.textContent = update.message;
const updateElement = document.querySelector('.update'); // safer than getElementsByClassName
if (update.message === "") {
updateElement.style.display = "none";
}
})
.catch(error => {
console.error('Error fetching data:', error);
businessCard.innerHTML = '<p>Error loading data. Check the console.</p>'; // Display an error message
});
});