我正在尝试在用户单击链接时重新加载表数据(行/TR),我可以添加更多/追加吗?数据,但我似乎无法在插入新表数据之前删除旧表数据。 (顺便说一句:updatetable.php 包含该表的所有(TR))
这是我正在尝试做的事情:
$(function() {
$("#append").click(function() {
var test;
$.get('updatetable.php', function(data) {
test = data;
$("#tablesorter-demo").remove();
$("#tablesorter-demo").append(test);
$("#tablesorter-demo").trigger.update(); // <--- I think that error is here, I tried to take out the trigger. but it still doesn't work ?
alert(test);
//return false;
});
});
href 代码是:<a id="append" href="#">Refresh Page</a>
最佳答案
试试这个:
$(function() {
$("#append").click(function(e) {
e.preventDefault();
$.get('updatetable.php', function(data) {
$("#tablesorter-demo").find('tbody').html('').append(data);
});
});
});
关于javascript - Tablesort 使用 Ajax 在单击时重新加载表数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17795507/