且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不刷新页面的情况下更新HTML表内容?

更新时间:2023-08-23 10:54:10

html

<tbody id="table-body">
    <?php include 'tableBody.php';?>
</tbody>

在按钮功能中

$.get("tableBody.php", function(data) {
    $("#table-body").html(data);
});

触发按钮功能时,它将把AJAX GET请求触发到tableBody.php,然后使用其内容更新ID为table-body<tbody>.

When the button function is trigger, it will fire up the AJAX GET request to the tableBody.php, and then use its content to update the <tbody> with id table-body.