I have a JSON object of the format:
{
"z061": {
"status": "restored",
"time": 135
},
"z039": {
"status": "restored",
"time": 139
}, ...
}
where there are 64 zones numbered z001 to z064.
What is the best way in Javascript to populate a table based on the "status" of zones z001 to z015? Here is my current code that only evaluates zone z003:
setInterval(function() {
$.getJSON("http://rackserver.local:8080",function(data) {
var temp = data.z003.status;
if (temp != "restored")
$("#securityTable tr:eq(3)").removeClass("error").addClass("success");
else
$("#securityTable tr:eq(3)").removeClass("success").addClass("error");
});
}, 1500);