JSON API call not storing data

Hey there,

My weather app is broken and I can’t quite pinpoint the issue.

Line 10 of the JS has a JSON call. The link shows me the correct object, but it isn’t stored correctly into data2.

Look at your browser’s console and you will see an error message like:

Mixed Content: The page at ‘https://codepen.io/justinbarr00/pen/vgxLVP’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://ip-api.com/json’. This request has been blocked; the content must be served over HTTPS.

Codepen serves their pages over https, so you can not make an AJAX call to an unsecure endpoint (url starting with http). You will need to find a secure url to use for the ip address to work with codepen.

1 Like