0

I have this code in js to get the current temperature, but now it only is the temperature in Groningen. How do I get the temperature on current location, using geolocation?

I know it has something to do with: api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon} But I don't know what to fill in for {lat} and {lon} and how to get the current location. Can someone please help?

            $(document).ready(function(){
                $.getJSON( "http://api.openweathermap.org/data/2.5/weather?q=Groningen&units=metric&appid=9334f947893792dcb9b2e2c05ae23eb0", function( data ) {
                    $('.weather').html(Math.round(data.main.temp)+ ' degrees Celcius');
                });

            });
John Slegers
  • 45,213
  • 22
  • 199
  • 169
Maris
  • 91
  • 1
  • 2
  • 10

0 Answers0