Archive for the ‘Weather Underground’ category

Get Weather Data for your website!!

May 30th, 2012

I have been looking at a few options on how to get live weather data for the web and I came across the Weather Underground’s weather API found HERE.  I have posted the code snippet below that will populate the divs with the according weather data using JQuery, I left out my API key for obvious reasons, but you can get a free one my following my link above and registering as a developer, enjoy!

                url: "<Your API Key>/geolookup/conditions/q/KY/Murray.json",
                dataType: "jsonp",
                success: function (parsed_json) {
                    $('#skyCondValue').append($('<option>', { value: "skyCond" }).text(parsed_json['current_observation']['weather']));
                    $("#windDirVal").append($('<option>', { value: "windDir" }).text(parsed_json['current_observation']['wind_dir']));
                    $('#envInfo').text(parsed_json['current_observation']['temp_f'] + " " + parsed_json['current_observation']['weather'] + " " + parsed_json['current_observation']['dewpoint_f'] + " " +
                    parsed_json['current_observation']['wind_mph'] + " " + parsed_json['current_observation']['wind_dir']);