Sebastian Sebastian - 1 year ago 88
Javascript Question

I Can't get data from JSON file - $.getJSON doesn't work
This is my codepen where I try to get data from a weather API. The link providing JSON data works, but none of what do here works:

$.getJSON(temperature, function(data) {
cityName.innerHTML = data;

-If i change data to a test string it doesn't work either.
- "$.get" doesn't work either


It's not an error with $.getJSON,just open the console of you bowser you will see this error.

jquery-2.2.4.min.js:4Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ''. This request has been blocked; the content must be served over HTTPS.

This is because the API provide by http but you page run in https,this will cause a security hole, so the bowser block the request.