// TODO: Completa questa funzione async function fetchWeatherData() { const loading = document.getElementById('loading'); const result = document.getElementById('result'); const weatherInfo = document.getElementById('weatherInfo'); // 1. Mostra il loading spinner loading.style.display = 'block'; result.classList.remove('show'); try { // 2. Scrivi qui il fetch per ottenere i dati da: // http://localhost:3000/api/weather // 3. Converti la risposta in JSON // 4. Mostra i dati nella pagina // SUGGERIMENTO: Usa la struttura vista nel tutorial // const response = await fetch('...'); // const data = await response.json(); console.log('Scrivi il codice qui!'); throw new Error('Codice non implementato'); } catch (error) { console.error('Errore:', error); result.classList.add('show'); weatherInfo.innerHTML = `
🌡️ Temperatura: ${item.temperature || item.temp || 'N/A'}°C
💨 Umidità: ${item.humidity || 'N/A'}%
☁️ Condizioni: ${item.condition || item.description || 'N/A'}
🌡️ Temperatura: ${data.temperature || data.temp || 'N/A'}°C
💨 Umidità: ${data.humidity || 'N/A'}%
☁️ Condizioni: ${data.condition || data.description || 'N/A'}