JSFiddle - React, Tailwind, and code Playground
by nickadeemus2002
HTML
<div id="wWarning">
<h1>Severe Weather Alert</h1>
<table class="wBox">
<h3>Data here</h3>
<h1 class="wLevel"></h1>
<h1 class="wColor"></h1>
</table>
</div>
JavaScript
$(function () {
// Specify the location and Api key
var apiKey = '1e6a89f0a3aa092d';
var location = 'zmw:00000.1.16172';
// Run the query (pull data from feed)
var url = 'http://api.wunderground.com/api/' + apiKey + '/alerts/q/' + location + '.json';
window['wCallback_3'] = function(data) {
alert('callback fired..');
// Get any weather alerts
var info = data.alerts;
// Warning level and color
$('#wWarning .wLevel').append('<TD>' + info.wtype_meteoalarm + '</TD>');
$('#wWarning .wColor').append('<TD>' + info.level_meteoalarm_name + '</TD>');
};
// Callback
$.ajax({
url: url,
dataType: 'jsonp',
contentType: "application/json",
cache: true,
jsonpCallback: 'wCallback_3'
});
});