Getting Geolocation in Weather App

Getting Geolocation in Weather App
0

#1

hello!
I am working on weather app. my current code status is- “https://codepen.io/karanatwal/pen/YxxVbZ”.
I am not getting geolocation. Can anyone help me out with this?


#2

I found two problems:

  1. You haven’t imported jQuery.

  2. The function you’re trying to call does not exist. Try the following instead:

      if(navigator.geolocation){   navigator.geolocation.getCurrentPosition(function(position){
       $("#location").html("latitude: "+position.coords.latitude+"<br>longitude: "+position.coords.longitude);