I have no idea why this is not working to log to the console the returned son from the fetch();
$(function() {
function showWeather(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
fetch("http://api.openweathermap.org/data/2.5/weather?lat=" + latitude + "&lon=" + longitude + "&APPID=cbbc0b873621d79ed73127c83e0a2deb").then(function(resp){
resp.json().then(function(data){
console.log(data);
});
});
}
if("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function(position){
showWeather(position);
});
} else {
console.error("You do not have geolocation in your browser!");
}
});