JSFiddle - React, Tailwind, and code Playground
by sstur
HTML
<div id="weather"></div>
JavaScript
$.getJSON('http://www.telize.com/geoip?callback=?', function(data) {
//var postalCode = data.zip_code || data.postal_code;
console.log(data);
var locationQuery = 'select woeid from geo.placefinder where text="' + data.latitude + ',' + data.longitude + '" and gflags="R"';
var query = 'select item from weather.forecast where woeid in (' +locationQuery + ')';
var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&format=json&callback=?';
$.getJSON(url, function(data) {
console.log(data);
var results = data.query.results.channel.item;
document.getElementById('weather').innerHTML = results.description;
});
});