Show Local Weather Problem

Hello, here is my code for the Show Local Weather question. I’ve tried to implement the Dark Sky Api first. But then, I’ve come across with the Cross-Origin error.

Now, I tried a different API, but now, console log error is: Failed to load resource: net::ERR_CONNECTION_REFUSED

I am stock because I don’t understand if the problem is about the code or (HTTPS) refusing protocol of Codepen. Because all of the topics I’ve read is about this…

I have also been stuck at this but I have tried jsonp which worked like a magic.

https://learn.jquery.com/ajax/working-with-jsonp/

Now, it says:

Mixed Content: This request has been blocked; the content must be served over HTTPS.

I was having this same problem with mine. Your example appears to just have an incorrect URL, or the API is down?

In either case, I used the OpenWeatherMap API and a ‘cors-anywhere’ URL preceding the request URL, like so:
https://cors-anywhere.herokuapp.com/http://api.openweathermap.org/data/2.5/weather

This let me use the OpenWeatherMap over HTTPS which I found simpler. I don’t think the DarkSky API should give you a CORS error if hosted over HTTPS, though.

You can download xxamp,wamp and host it from there. It will be easy to test from and work with.