Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#getLocation").on("click", function() {
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(function(position) {
- $("#location").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);
- lat = position.coords.latitude;
- lon = position.coords.longitude;
- api = "api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&APPID=f7dcb8e5d6a1f2126a2080a1e0d17b5a";
- console.log(api);
- $.getJSON(api, function(json) {
- $("#api").html(json);
- });
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement