【发布时间】:2014-06-06 07:25:08
【问题描述】:
使用带有 dom 创建表的数据表 1.10。我正在尝试在 ajax 响应中添加新的数据行,但没有任何反应。相同的代码本身(没有 ajax)工作得非常好。是的,response.success 正在返回“true”。
// 这工作并将新行添加到表中
$('#test').on('click', function () {
dt.row.add( [
'td0',
'td1',
'td2',
'td3'
] ).draw();
});
//相同的代码在 ajax 响应中不起作用...
$('#dtCreate').on('click', function () {
$.ajax({
type: 'post',
url: '/test/process/p_db_create.php'
}).done(function (response) {
//double check response
console.log(response);
if (response.success)
{
//add the row since this is not serverside
dt.row.add( [
'td0',
'td1',
'td2',
'td3'
] ).draw();
...more code below...
【问题讨论】:
-
你有没有找到解决这个问题的方法?我遇到了同样的问题。
标签: jquery ajax datatables jquery-datatables