docs/backups/pwa-api/js/index.js
//fetch openweather map url with api key
fetch openweather map url with api key
fetch openweather map url with api key
function weatherdata(position) {
    fetch('https://api.openweathermap.org/data/2.5/weather?lat=' + position.coords.latitude + '&lon=' + position.coords.longitude + '&appid=b2c336bb5abf01acc0bbb8947211fbc6')
        .then(response => response.json())
        .then(data => {
            console.log(data);
            document.getElementById("demo").innerHTML =
                '<br>wind speed:-' + data.wind.speed +
                '<br>humidity :-' + data.main.humidity +
                '<br>temprature :-' + data.main.temp
        });
}
function weatherdata ( position ) { fetch ( 'https://api.openweathermap.org/data/2.5/weather?lat=' + position . coords . latitude + '&lon=' + position . coords . longitude + '&appid=b2c336bb5abf01acc0bbb8947211fbc6' ) . then ( response => response . json ( ) ) . then ( data => { console . log ( data ) ; document . getElementById ( "demo" ) . innerHTML = '<br>wind speed:-' + data . wind . speed + '<br>humidity :-' + data . main . humidity + '<br>temprature :-' + data . main . temp } ) ; }
fetch openweather map url with api key
fetch openweather map url with api key
//put corrdinates to get weather data of that location