我有一個從控制器在索引方法發送的數據中加載的選項卡中的數據表。重新加載數據表而無需使用ajax刷新
$data = array(
'documents' => $this->getDocuments(),
//more stuff...
);
$this->load->view($this->config->item('groupViews') . 'example/example_edit_view', $data);
我有裝載數據表
<div class="form-group col-md-12">
<table
id="t_documents"
class="table table-striped table-bordered table-hover"
cellspacing="0"
width="100%">
</table>
</div>
的觀點,然後我加載數據表中的JavaScript時,頁面加載
var documentos = <?php echo json_encode($documents); ?>;
if (documentos !== null){
var table = $('#t_documents').DataTable({
language: {
"url": "<?=trad($this,'LANG_DATATABLES');?>"
},
data: documents,
paging: true,
ordering: true,
pageLength: 10,
columns: [
{ title: "" }, //Download button
{ title: "<?=trad($this,'FILE_NAME');?>" },
{ title: "<?=trad($this,'FILE_TYPE');?>" },
{ title: "" } //Delete button
]
});
}
我有一個刪除功能了。如何重新加載數據(使用ajax從控制器再次獲取數據)而不重新加載頁面?
使用ajax請求 – madalinivascu