API Trouble - Can't get api to accept coords

Hey everybody,

I’m trying to build my weather app and can’t seem to get my API to work properly. The key is correct and I have a valid account with them so that’s not the issue. I even have the .getCurrentPosition function properly but I don’t know how to get the API URL to accept or determine the coordinates for it to do its thing?

if (navigator.geolocation) {

  navigator.geolocation.getCurrentPosition(function(position) {
    var lat = position.coords.latitude;
    var lon = position.coords.longitude;
   
    var api = "api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon="+lon+"&appid=*******mykey*******";
    
    $("#location").html("latitude: " + lat + "<br>longitude: " + lon);    
  });
};