From your comment, it sounds like parsed_json['current_observation']
is returning undefined
, probably because parse_json
isn't what your code expects it to be.
To troubleshoot, add a console.log(parsed_json)
as the first line of your success()
function and see what the output looks like. This way we can see what you're getting back from the server.
You can also try simply copying/pasting the URL into your browser window and looking at the JSON from there: http://api.wunderground.com/api//conditions/forecast/q/autoip.json
I'm guessing either 1) wunderground can't read your location and is sending back a JSON error, or some kind of JSON format that your code isn't expecting, or 2) your work is blocking the URL and you're getting nothing back or the HTML for an error page or something. You'll find out when you console.log
the response and inspect it manually.
Edit: And if wunderground returns a consistent error format (check their API), you can make your code more robust by checking for that error in the response before trying to parse it.