$.getJSON won't work in codepen. PLEASE HELP - LOCAL WEATHER

First: I had to make the url https instead of http so the geographical location can work
second: $.getJSON(api, function(data) {
});

is not working at all. I keep testing it using alert(“hi”) and it just doesnt work. I don’t know whats wrong.
Please help me

You can’t make a http api request if you use https to load your site. You will either need to use a api that uses https or you can use something like https://cors-anywhere.herokuapp.com

1 Like