0

This code loads two parameters from a PHP file and prints them on the screen every second, but does that not use too much cpu/memory power to run it? How can that be avoided? I want to free/release or autorelease the memory it's using, while it's updating, but I don't know how... Please help me out guys.

function updateStats(stat) {
  var stat = ["NAME","ID"];
  var url = "USERS.php";
  $.each(stat, function(i, key){
    $.post(url, {stats: key}, function(data) { // stats to stat
      $("#" + key).html(data);
    });
  });
}

setInterval(function(){
  updateStats("updateStats");
}, 1000);
4

1 に答える 1

1

JavaScript は、使用されていないものを自動的に消去します。このコードにはメモリの問題はありません。

于 2012-06-01T10:51:00.243 に答える