getJSON function as in challenge doesn't work for project

getJSON function as in challenge doesn't work for project
0

#1

I have been searching for a good way to use getJSON but nothing really worked.
So I discussed it on the chat and we came up with a code that does work.
My problem now is that I used the exact code as described in the third challenge of JSON API’s and ajax
"Get JSON with the jQuery getJSON Method"

So this is the code I used that didn’t work
$.getJSON(“http://api.openweathermap.org/data/2.5/weather?q=bruges&units=metric&lang=en&appid=88b75e0f51b809b601a2e4f76955cdf0”, function(data){$("#weatherMap").html(JSON.stringify(data));

so the “#weatherMap”).html seems to be the problem.

This is the code that does work.

var data = $.getJSON(“http://api.openweathermap.org/data/2.5/weather?q=bruges&units=metric&lang=en&appid=88b75e0f51b809b601a2e4f76955cdf0”, function(data){html(JSON.stringify(data));

so here there’s no pointer to a class or id and the function starts with html(JSON.stringify(data));

why doesn’t the first one work although the second one works.
It really bugs me because the first one, is the one showed to us by the challenge.

I didn’t put in any other code nor the html code because it’s only above code that is bugging me.
All the rest is as it should be.

Can someone with more experience explain what the difference is between both codes and why it’s not working in one code.

okay, now it’s working again as in the challenge so this thread can be closed.