我需要实时显示我的内容,但是当加载这么多东西时,它占用了很多CPU并且非常迟钝.
我的代码下面有替代品吗?
$(document).ready(function() {
var refresh_bal = setInterval(
function (){
$.get('./php/get_balance.php', function(balance) {
$('.balance').html(balance);
});
}, 1000);
var refresh_total = setInterval(
function (){
$.get('./php/get_total_bets.php', function(total) {
$('.total').html(total);
});
}, 1000);
var refresh_profit = setInterval(
function (){
$.get('./php/get_profit.php', function(profit) {
$('.profit').html(profit);
});
}, 1000);
$('.haa').on('click', function() {
var refresh_bets = setInterval(
function (){
$.get('./php/get_bets.php', function(bets) {
$('.betsTable').html(bets);
});
}, 1000);
});
var refresh_site = setInterval(function (){
$.get('./php/get_site.php', function(site) {
$('.siteStats').html(site);
});
}, 1000);
var refresh_client = setInterval(function (){
$.get('./php/get_client.php', function(client) { …Run Code Online (Sandbox Code Playgroud)