Local Weather Challenge Problems

I cannot seem to figure out the problem with my code and cannot find any other times this has happened to anyone. Please help

(http://codepen.io/NickKatchur/pen/JbodxZ)

The problem is in assigning my “apiUrl” variable, if you look at the console I print out what it gives me and I don’t see where I’m going wrong. Any help would be appreciated, thanks!

$.getJson is an asynchronous function. Basically it requests some data and let’s the code go further while it waits for a response - the data to arrive.

$.getJSON("url", function(data) {
	// this is the code that runs when you receive data - after request finishes
});
// this is the code that will run first - before request finishes

Jquery promises might be a topic worth investigating.
https://api.jquery.com/promise/
https://api.jquery.com/jquery.when/
https://api.jquery.com/deferred.then/

1 Like

Thank you so much I didn’t know that. Fixed!