先定义一个表格,利用ajax首先加载一次数据。
序号 |
总交易数 |
成功交易数 |
成功百分比(%) |
失败交易数 |
失败百分比(%) |
未知交易数 |
<举搜div align="center">未知百分比(%) |
统计时间段 |
然后在页面定义一个ajax方法定时去后台查询数据就可以。
function loadData(){
$.ajax({
type: "POST",
url: "<%=path %>/two",
dataType: "json",
data:{'startTime':startTime,'endTime':endTime},
success: function(returnedData){//查询成功之后填充表格
var html = "";
var tdHead = "
"; var tdFoot = " | ";
$("#t2 tr:gt(0)").remove();//第一行是table的表格头不需清除。
for(var i=0;i
var countInfo = returnedData[i];
var totalCount = countInfo.totalCount;
var sucCount = countInfo.sucCount;
var failCount = countInfo.failCount;
var unknowCount = countInfo.unknowCount;
var sucPercent = countInfo.sucPercent;
var failPercent = countInfo.failPercent;
var unknowPercent = countInfo.unknowPercent;
var countTimeZone = countInfo.countTimeZone;
html += "" + tdHead + (i + 1) + tdFoot +
tdHead + totalCount + tdFoot +
tdHead + sucCount + tdFoot +
tdHead + sucPercent + tdFoot +
tdHead + failCount + tdFoot +
tdHead + failPercent + tdFoot +
tdHead + unknowCount + tdFoot +
tdHead + unknowPercent + tdFoot +
tdHead + countTimeZone + tdFoot + "
";
}
$("#t2").append(html);//将新数据填充到table
}
});
}