私は頭の毛を引き裂こうとしています。いくつかの時間を測定しているPHP関数とやり取りしようとしています: timeSince() 投稿が投稿されました。
jQueryでこれを行うためのプラグインは必要ありません、ありがとう:o)
しかし、すべての .post-box-time div で $.get() を実行したくないので、$.each を使用しています。しかし、それは最後の要素を更新するだけですが、他のdivの結果が得られます。-> $.each(). を実行していないようです。
これが私のコードです:
setInterval(function() {
$('.post-box-time').each(function() {
var time = $(this).attr('data-time');
$this = $(this);
$.get("sys/calls.handler.php", { do: 'timeSince', data: time },
function(data){
$this.html(data);
});
}); // each function
}, 1000);