Skip to content

Instantly share code, notes, and snippets.

@digitalinkwell
Last active August 29, 2015 14:19
Show Gist options
  • Save digitalinkwell/6bd41e956064765c685b to your computer and use it in GitHub Desktop.
Save digitalinkwell/6bd41e956064765c685b to your computer and use it in GitHub Desktop.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" charset="utf-8"></script>
<script src="<?php echo esc_url( home_url( '/' ) ); ?>/jquery.simpleWeather.js" charset="utf-8"></script>
<script type="text/javascript">
$(function() {
$.simpleWeather({
location: 'london, united kingdom',
unit: 'c',
success: function(weather) {
html = '<h2>'+weather.city+', '+weather.region+'</h2>';
html += '<img style="float:left;" width="125px" src="'+weather.image+'">';
html += '<p>'+weather.temp+'&deg; '+weather.units.temp+'<br /><span>'+weather.currently+'</span></p>';
html += '<a href="'+weather.link+'">View Forecast &raquo;</a>';
$("#weather2").html(html);
},
error: function(error) {
$("#weather2").html('<p>'+error+'</p>');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment