Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refreshJSON(url) {
- $.getJSON(url, function (data) {
- temps = [];
- var html = "";
- var el = document.getElementById("jsonTable");
- $.each(data.weather, function (key, val) {
- if (val.value >= 20) {
- html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_clear.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
- } else if (val.value < 20 && val.value >= 10) {
- html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_clouds.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
- } else if (val.value < 10 && val.value >= 0) {
- html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_many_clouds.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
- } else if (val.value < 0 && val.value >= -10) {
- html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_rain.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
- }
- temps.push(val.value);
- });
- el.innerHTML = html;
- min = Math.min.apply(null, temps);
- max = Math.max.apply(null, temps);
- $("#jsonTable").animate({ width: "40%" }, "slow");
- drawGauge(min,max);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement