JSFiddle - React, Tailwind, and code Playground

by flexin

HTML

<div id="weather">
    <div class="current-weather"></div>  
    <div class="code"></div>
    <span class="temp"></span> °C
</div>

JavaScript

var codes = new Array();
codes[800] = 'Heldere hemel';
codes[804] = 'zwaar bewolkt';

$.getJSON('http://api.openweathermap.org/data/2.5/weather?q=la tour-sur-orb&units=metric&APPID=d65a0086e785ef4b9b7a5e3fa8b1b1f1', function(data) {
    $('.current-weather')
        .append('<img src="http://openweathermap.org/img/w/' +  data.weather[0].icon + '.png" alt="' + data.weather[0].description + '">');
    
    $('.code').html(codes[data.weather[0].id]);
    $('.temp').html(Math.floor(data.main.temp));
    console.debug(data);
});





$.getJSON('http://api.openweathermap.org/data/2.5/forecast?q=La Tour-sur-orb&APPID=d65a0086e785ef4b9b7a5e3fa8b1b1f1', function(data) {
    
    console.debug(data);
});