Through several sources this is the code I came up with. I cant seem to return anything in the console. Can you help.
function geoLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
"Geolocation is not supported by this browser"
}
}
function showPosition(position) {
var x = document.getElementById("latitude").innerHTML="Latitude: " + position.coords.latitude;
var y = document.getElementById("longitude").innerHTML="Longitude: " + position.coords.longitude;
}
var weather =' https://fcc-weather-api.glitch.me/api/current?lat=' + x + '&lon=' + y + '.json';
$.ajax({
url:weather,
dataType : "jsonp",
success: function(data) {
var desc = data['description']
}
});
geoLocation();