上点击使用Ajax Tablesort刷新表数据? [英] Tablesort Reload Table Data on Click using Ajax?

查看:102
本文介绍了上点击使用Ajax Tablesort刷新表数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图重新加载表数据(行/ TRS),当用户点击一个链接,我可以添加更多的/追加?数据,但我似乎无法插入新表数据之前,删除旧表中的数据。 (顺便说一句:在updatetable.php包含了所有的(TR的),该表)

I'm trying to reload the table data (rows/TRs) when the user clicks a link, I can add more/append? the data but I cannot seem to delete the old table data before inserting the new table data. (BTW: the updatetable.php contains all of the (TR's) for that table)

下面是我想要做什么:

$(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 code是:&LT;一个ID =追加的href =#&GT;刷新页面&LT; / A&GT;

推荐答案

试试这个:

$(function() {

    $("#append").click(function(e) { 

        e.preventDefault();

        $.get('updatetable.php', function(data) {
            $("#tablesorter-demo").find('tbody').html('').append(data);
        });

    });

});

这篇关于上点击使用Ajax Tablesort刷新表数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆