Posts Tagged ‘API’

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