Unable to retrieve weather JSONP via $.getJSON. Unable to determine the exact problem due to ignorance


I am currently having a lot of trouble with the local weather project. Right now, I’m trying to get my javascript to:

  1. Set location (city, country) via getLocation().

  2. As a part of getLocation()'s callback, retrieve JSON weather data from Open Weather Map via getWeather().

  3. As a part of getWeather()'s callback, copy the JSON into a variable.

The code runs until the $.getJSON method of getWeather(), then stops. I’m unable to determine why this is the case, given that the URL is good and that it nets a callback when entered manually. I haven’t been able to get a single successful API call from Open Weather Map despite trying the crossorigin and heroku workarounds.

It works for me. If I console.log(response) inside the callback from the weather API, I can see a JSON object with all the info.

It’s suddenly working on my end too! Don’t get too excited now, but I think you may be MAGIC.

1 Like