Weather Underground API improvement

Posted: October 16, 2013 in CC Lab
Tags: , ,

Screen Shot 2013-10-16 at 5.23.32 PM

I managed to write a javascript function that creates html elements for the API calls from Weather Underground. This way I don’t have to hard code an API call for each city. The function is passed an object that contains {“key” :  “value”} pairs of states (or countries) and cities,as well as parameters such as the API key, specific data to grab, and the html list element to append new list item elements to. A satellite image and various other weather data  are pulled for each location and then written to the DOM. I also got this script running locally using Node.js and Python’s SimpleHTTPServer module.  

Live example here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s