Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function refreshJSON(url) {
  2.  
  3.         $.getJSON(url, function (data) {
  4.             temps = [];
  5.             var html = "";          
  6.             var el = document.getElementById("jsonTable");
  7.             $.each(data.weather, function (key, val) {            
  8.                 if (val.value >= 20) {
  9.                     html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_clear.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
  10.                 } else if (val.value < 20 && val.value >= 10) {
  11.                     html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_clouds.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
  12.                 } else if (val.value < 10 && val.value >= 0) {
  13.                     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>";
  14.                 } else if (val.value < 0 && val.value >= -10) {
  15.                     html += "<tr><td class=\"datetime\"> " + val.datetime + "</td><td><img src=\"Images/status_rain.png\" /></td><td class=\"value\">" + val.value + " °C</td></tr>";
  16.                 }
  17.                
  18.                 temps.push(val.value);              
  19.             });
  20.             el.innerHTML = html;
  21.             min = Math.min.apply(null, temps);
  22.             max = Math.max.apply(null, temps);
  23.             $("#jsonTable").animate({ width: "40%" }, "slow");
  24.            
  25.  
  26.             drawGauge(min,max);
  27.         });
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement