0

我正在使用http://code.cyntaxtech.com/plugins/jquery-timer库(jquery.timer.js)。

$(document).ready(function() {

    var previous_id=$("#rows td").first().text();

    $('#rows').timer({
        delay: 5000,
        repeat: true,
        url: "test.php?id="+previous_id,
        callback: function() {
            // insert a new <td> element with value that must be a 'previous_id' in next timer fire
        }
    });
});

每次我收到旧的 previous_id 值 :( 我已经阅读了一些文章并了解我必须在函数(计时器)中确定变量 previous_id。但是我该如何在上面的代码中做到这一点?

4

1 回答 1

0

设置变量` after inserting the newtd`

callback: function() {
            // insert a new <td> element with value that must be a 'previous_id' in next timer fire
            previous_id=$("#rows td").first().text();
        }
于 2013-10-30T05:28:59.007 回答