Show local weather

hello,
i’ve been stuck for a few days on “show the local weather” project.
can anyone explain what’s wrong in my code, why can’t i get the alert?

$(document).ready(function(){

var api = “https://api.darksky.net/forecast/myapikey/37.8267,-122.4233”;

$.getJSON(api, function(data){

alert(data.latitude);
});

});

myapikey actually has my api key.

thanks!

Have you tried adding ?callback=? at the end of your url?

Like

https://api.darksky.net/forecast/myapikey/37.8267,-122.4233?callback=?

it works! thanks! you saved me from absolute madness

Alternatively, you could switch to a .get() with a third parameter of jsonp.

$.get(api, function(data){
    alert(data.latitude);
}, 'jsonp');