So i’m trying to make a weather app but can’t seem to get data out of the API.
Here is the code:
var api= “https://api.darksky.net/forecast/879f3d4aa91c701894de75f31f8c6773/56,24”
$.getJSON(api, function(data){
console.log(data.currently.summary);
});
});
The console is empty and i don’t know what i did wrong…
Oxyrus
2
Try logging the data
instead to see what is there.
Tried that aswell…
Here is the code pen: https://codepen.io/ArmoredCub/pen/vZxpqB
Oxyrus
4
If you look at the console it says $
is not defined, did you import jQuery?
That was the first thing i did but for me it does not even show that in the console
Oxyrus
6
So it’s denying access to the API because of the key? Is there any way to fix that?
Oxyrus
8
I would suggest you to use another API such as openweather, in fact I now remember that I faced the same issue as you when I did my project.
Search here in the forums, there are probably workarounds.
the apixu api helped me with building this app
https://www.apixu.com/
Hope it can help!