jQuery Plugin For Displaying Weather Data On Your Website - WhatWeather

File Size: 88.6 KB
Views Total: 25203
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Plugin For Displaying Weather Data On Your Website - WhatWeather

WhatWeather is a jQuery plugin to provide meteorological data using worldweatheronline.com API. WhatWeather not only provide weather data, but it also gives you the ability to easily implement weather widgets that can retrieve, edit, and deliver weather data.

See also:

How to use it:

1. To use WhatWeather, you must go to the worldweatheronline.com site and get a free key to use their API. 

2. To communicate with worldweatheronline.com, WhatWeather performs an Ajax request that uses the PHP get_weather.php file. 

// your private key
$yourKey  = "ma_cle";
// if the geolocation or IP options
$location = isset($_POST["latitude"]) && isset($_POST["longitude"]) && $_POST["latitude"] && $_POST["longitude"] ?
                 $_POST["latitude"].",".$_POST["longitude"] : $_POST["city"];
$location = isset($_POST["ip"]) && $_POST["ip"] == "true" ? $_SERVER["REMOTE_ADDR"] : $location;
// echo the result
echo file_get_contents("http://free.worldweatheronline.com/feed/weather.ashx?"
."q=". $location ."&"
."num_of_days=". $_POST["days"] ."&"
."key=". $yourKey);

3. Include necessary javascript files on the web page

<link href="css/webfont/climacons-font.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.2.0.0.js"></script>
<script type="text/javascript" src="js/mustache.js"></script>
<script type="text/javascript" src="js/whatweather.0.6.js"></script>

4. Simple Usage:

<script type="text/javascript">

Change Log:

  • Update to v1.1.0 (2013-06-16)

This awesome jQuery plugin is developed by getkode. For more Advanced Usages, please check the demo page or visit the official website.