1

我希望在同一页面上列出的列表页面中显示新添加的数据。我的问题是,将数据添加到我的数据库后,我需要重新加载整个页面才能查看新数据。如何在不重新加载整个页面的情况下查看?

列表页面

4

2 回答 2

1

If you only want to refresh the table, you can use this jQuery plugin: http://datatables.net

You can call table refresh functions whenever you want. The plugin works using AJAX. To work with you need to have little javascript knowledge as well.

You can find sort of example/demo from here. http://editor.datatables.net/tutorials/api_manipulation

However if you really want to do this get the concept and you also can develop same thing. You just require to learn some AJAX.

于 2012-12-21T08:43:15.410 回答
0

在将数据保存到数据库后单击按钮,您需要使用以下脚本。无需往返于服务器到客户端,而是操作客户端。

$("#btnSubmit").click(function () {
$('#myForm').ajaxForm({ 
    success:   function(){
       $('#myTable tr:first').after('<tr><td>' + $("#Name").val() + '</td></tr>');
    }
}); 
});
于 2012-12-21T08:34:28.577 回答