I am trying to get the city and state for the Dark Sky API, but that isn’t included in the JSON response of the API. So, as suggested by another camper, I will be using the Google Geolocation API.
My problem is getting the Skycons to play. Not certain what I am doing wrong.
Another thing I am struggling with is the fahrenheit/celsius toggling.
You can find my CodePen here: https://codepen.io/twhite96/pen/OXEEJG/
Hi there! Not sure I can help with the former issue but with the toggling, I created 2 buttons, one for F and the other for C. Whenever you click on one it will take the temperature variable and push it to an empty heading tag. Perhaps what you can do is declare your temperature variables at the top of your document.ready so you can use them in a click function.
Don’t do it! Nature took my hair, and I miss it.
To fix your Skycon problem, just pass the icon data from Darksky into the
add function. You have it stored in the variable
Okay thanks! Will look at it when I get back to the computer.
This makes sense. I’ll have to give it a look.
Hey that works!!! Do you know how I could get the city and state? Chrome will not serve the information over http. I think I could use Google Geolocation API. Do you know much about this?
Try https://www.geoip-db.com/ for the city and state.
I also used darksky’s API in my weather app, and I determined the location from the longitude and latitude with google’s geocoding API (with reverse geocoding). I hope that helps!