<body> <!-- Credit for this goes towards Matt Froese @mattfroese --> <!-- Update the API Key and Update the Zip Code for your own city. Get API key from https://openweathermap.org/api ## API Key = const key ## ## Zip Code = weatherBallon ## (go to website, search for your city, your weatherBallon is in the URL) --> <div> <div id="description"></div> <a href="https://openweathermap.org/city/4581095"> <h1 id="temp"></h1> </a> </div> <script> const key = '722ee3ab29754a08dbb548a3673860d1'; if (key == '') document.getElementById('temp').innerHTML = ''; function weatherBallon(cityID) { fetch('https://api.openweathermap.org/data/2.5/weather?id=' + cityID + '&appid=' + key). then(function (resp) {return resp.json();}) // Convert data to json .then(function (data) { drawWeather(data); }). catch(function () { // catch any errors }); } function drawWeather(d) { var celcius = Math.round(parseFloat(d.main.temp) - 273.15); var fahrenheit = Math.round((parseFloat(d.main.temp) - 273.15) * 1.8 + 32); var description = d.weather[0].description; document.getElementById('temp').innerHTML = fahrenheit + '°'; } window.onload = function () { weatherBallon(4581095); }; </script> </body>