Posts Tagged ‘ajax’

Fun with the Weather Underground API

Posted: September 27, 2013 in CC Lab
Tags: , ,

wunderground_api_fun

link to live example here

code on github here

For this assignment I used the Weather Underground’s API to create weather identifiers for some of my favorite cities. The API call grabs data for satellite imagery, current weather, wind, high, and low temperatures for the day. In my next iteration (unfinished) I’m looking to write the javascript code so that an object of areas and cities can be given rather than rewriting the $.ajax script 4 times. ¬†For example an object called `geo` would have the following:

{
‘NY’ : ‘New_York’,
‘CA’ : ‘San_Francisco’,
‘MI’ : ‘Detroit’,
‘Germany’ : ‘Berlin’
}

and could be passed to a function that then generates data for all four locations, rather than hard-coding them. A further option could ask for a list of cities as user input and then generate the data.