getJSON callback not successful

My callback isn’t working and I can’t see why. I’ve tested the URL and that works fine. Can anyone spot whats wrong?

   function getWeather(c,r){
  
  $.getJSON("api.openweathermap.org/data/2.5/weather?q=London&units=metric&APPID=09d1d2672d1bedcb1e31be0fa0b459fa", function(data) {
    console.log("test")
  
  });
}

Hi @EndaMolloy

You need prepend http like so: http://api.openweathermap.org/...

What it’s doing at the moment is seeing that as a relative path and doing something like: codepen.io/{...}/api.openweathermap.org/{...}

Such a silly oversight, thank you

1 Like