Hey. So i’m trying to do the local weather project and want to get my location coordinates. since there already was a task on freecodecamp called “Get Geolocation Data” in witch you need to get your own location, i used the same code
-----------------------html
<div id = "data">
<h4>You are here:</h4>
</div>
----------------------js
$(document).ready(function(){
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);
});
}
});
and pasted it into the codepen, but it does not load my location coordinates. and i cant understand why. (i allowed browser to get my location, im added JQuerry on my pen)