我正在使用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。但是我怎么能在上面的代码中做到这一点?
答案 0 :(得分:0)
设置变量` after inserting the new
td`
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();
}