document.addEventListener('DOMContentLoaded', function () { const contactForm = document.getElementById('contactForm'); if (contactForm) { contactForm.addEventListener('submit', function (e) { e.preventDefault(); const form = e.target; const formData = new FormData(form); const status = document.getElementById('form-status'); // Basic client-side validation const name = formData.get('name'); const email = formData.get('email'); const message = formData.get('message'); if (!name || !email || !message) { status.innerHTML = '
No active severe weather alerts from the SPC at the moment.
Could not load cyclone data. Please try again later.
'; console.error('Error fetching cyclone data:', error); }); } // Fetch and display wildfire data const wildfireDataContainer = document.getElementById('wildfire-data'); if (wildfireDataContainer) { fetch('api/wildfires.php') .then(response => response.json()) .then(data => { if (data && data.length > 0) { let html = ''; data.forEach(fire => { html += `${fire.acres ? Math.round(fire.acres) + ' acres' : 'Size not available'}
${fire.percent_contained !== null ? fire.percent_contained + '% contained' : 'Containment not available'}
No active wildfires reported at the moment.
Could not load wildfire data. Please try again later.
'; console.error('Error fetching wildfire data:', error); }); } });