I am trying to get geo coordinates and then return them into my HTML. This is the code I have so far, but it is not returning the coordinates onto my page:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#cityname").html("latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude);
});
}
I have an id in my html named 'cityname'. I would also like to convert the coordinates into a city name.