$.ajax({
url:base+"ReadGBook",//发送请求地址
type: "post",
dataType : "json",
success:function(data,textStatus){
$(".gbook").remove();
console.debug(data);
var sourceNum = data.sourceNum;
var datas = data.datas;
for(var i = 0 ; i < sourceNum; i ++){
var book = document.getElementById("book");
var div = document.createElement("div");
div.setAttribute("class", "gbook");
book.appendChild(div);
console.debug(datas[i].info.indexOf("正常"));
if(num<3){
if(datas[i].info.indexOf("正常")== -1){
num++;
div.style.color = "yellow";
div.innerHTML = datas[i].source+ "成长书打印出错";
}else{
lastTimes[i] = datas[i].time;
div.style.color = "black";
div.innerHTML = datas[i].source+ "成长书打印正常";
}
}else if(num >= 3){
if(datas[i].info.indexOf("正常")== -1){
num++;
div.style.color = "red";
div.innerHTML = datas[i].source+ "成长书打印出错";
}else{
if(datas[i].time==lastTimes[i] && waitnum != data.waitNum){
num++;
div.style.color = "red";
div.innerHTML = datas[i].source+ "成长书打印出错";
}else{
num = 0;
lastTimes[i] = datas[i].time;
div.style.color = "black";
div.innerHTML = datas[i].source+ "成长书打印正常";
}
}
}
}
waitnum = data.waitNum;
},
error: function(){
}
});
url:base+"ReadGBook",//发送请求地址
type: "post",
dataType : "json",
success:function(data,textStatus){
$(".gbook").remove();
console.debug(data);
var sourceNum = data.sourceNum;
var datas = data.datas;
for(var i = 0 ; i < sourceNum; i ++){
var book = document.getElementById("book");
var div = document.createElement("div");
div.setAttribute("class", "gbook");
book.appendChild(div);
console.debug(datas[i].info.indexOf("正常"));
if(num<3){
if(datas[i].info.indexOf("正常")== -1){
num++;
div.style.color = "yellow";
div.innerHTML = datas[i].source+ "成长书打印出错";
}else{
lastTimes[i] = datas[i].time;
div.style.color = "black";
div.innerHTML = datas[i].source+ "成长书打印正常";
}
}else if(num >= 3){
if(datas[i].info.indexOf("正常")== -1){
num++;
div.style.color = "red";
div.innerHTML = datas[i].source+ "成长书打印出错";
}else{
if(datas[i].time==lastTimes[i] && waitnum != data.waitNum){
num++;
div.style.color = "red";
div.innerHTML = datas[i].source+ "成长书打印出错";
}else{
num = 0;
lastTimes[i] = datas[i].time;
div.style.color = "black";
div.innerHTML = datas[i].source+ "成长书打印正常";
}
}
}
}
waitnum = data.waitNum;
},
error: function(){
}
});