function update(){ $.ajax( "/stats", { success: function (res){ $("#broadcaster").text(res.data.broadcast.broadcaster) $("#isBroadcasting").text(res.data.broadcast.isBroadcasting) $("#streamUrl").text(res.data.broadcast.streamUrl) $("#forceNotBroadcasting").text(res.data.config.forceNotBroadcasting) $("#forceStopDownload").text(res.data.config.forceStopDownload) $("#forceNotUpload").text(res.data.config.forceNotUpload) $("#updateTime").text(res.data.broadcast.updateTime) $("#download").html(function(){ var ret = "" res.data.download.reverse().forEach(function(obj){ ret += "" + obj.datetime + "" + obj.message + "" }) return "" + ret + "
" }) $("#encode").html(function(){ var ret = "" res.data.encode.reverse().forEach(function(obj){ ret += "" + obj.datetime + "" + obj.message + "" }) return "" + ret + "
" }) $("#upload").html(function(){ var ret = "" res.data.upload.reverse().forEach(function(obj){ ret += "" + obj.datetime + "" + obj.message + "" }) return "" + ret + "
" }) $("#error").html(function(){ var ret = "" res.data.error.reverse().forEach(function(obj){ ret += "" + obj.datetime + "" + obj.message + "" }) return "" + ret + "
" }) } } ) } update() setInterval(update,10000)