function getData() { const city = document.getElementById("city").value; const start = document.getElementById("start").value; const end = document.getElementById("end").value; const storageOption = document.getElementById("storage").value; const formatOption = document.getElementById("format").value; const apiKey = "1244099aeaee4b179e6111803241304"; const apiUrl = `https://api.weatherapi.com/v1/current.json?key=${apiKey}&q=${city}&aqi=no`; fetch(apiUrl) .then((response) => { if (!response.ok) { throw new Error("Network response was not ok"); } return response.json(); }) .then((data) => { // Wetterdaten anzeigen document.getElementById("weatherData").innerText = JSON.stringify( data, null, 2 ); }) .catch((error) => { console.error("There was a problem with the fetch operation:", error); }); }