var dataUpload = {
//ajax请求数据
method:function(murl,mdata,method,time1,time2,success){
/*首次读取*/
setTimeout(function() {
aJax();
},time1);
/*定时读取函数*/
setInterval(function() {
aJax();
},time2);
function aJax(){
$.ajax({
type: method,
url: murl,
dataType : "json",
data: mdata,
error: function (data) {
console.log(data);
alert("请求失败");
},
success: function (data) {
//传出
success?success(data):function(){};
}
});
}
}
}
//调用 总售票量
dataUpload.method("data/total","","GET",200,60000,function (data) {
console.log(data,"总售票量"); //294812 "总售票量"
var saletotal = data;
var sA = transform(saletotal);
$("#totalSale").html(sA );
});
// 今日售票量
dataUpload.method("data/today","","GET",200,60000,function (data) {
console.log(data,"today");
var onlinevehiclecount = data;
var ssss = transform(onlinevehiclecount);
$(".shuttleLine").html(ssss );
});