【发布时间】:2017-03-30 08:35:54
【问题描述】:
我已经生成了记录,每一行都有删除按钮,当我点击删除按钮时,它会从数据库中删除记录。此外,删除后它将重新加载数据表。有什么帮助吗?
数据表:
var table = $('#table').DataTable({
"processing": true,
//some settings?
});
jQuery:
$(document).on('click', '[id^="delete-product-"]', function() {
var id = this.id.split('-').pop();
$.ajax({
type: 'post',
url: 'my_controller/delete_product',
dataType: 'json',
data: {id: id},
success: function(callback)
{
//What should I code here, that can't reload entire page, only the table
//after deleting records
},
error: function(status)
{
console.log(status);
}
});
});
任何帮助将不胜感激。提前谢谢你
【问题讨论】:
标签: jquery ajax codeigniter datatables