需要帮助我有3个ajax在哪里 - 如果点击将显示ajax B,来自ajax A的数据有按钮 - 如果点击将显示ajax C,来自ajax B的数据有按钮 问题是来自ajax A的数据表,如果我正在寻找新的搜索 来自ajax B的数据仍然是OLD如何在ajax A加载之前从ajax B dan C中清除数据 这是我的ajax A代码:
<script type="text/javascript">
var save_method; //for save method string
var table; //for ajax A
var table2; // for ajax B
var table3; // for ajax C
var base_url = '<?php echo base_url()?>';
// table2 = $('#table_id2').clear();
// table2 = $('#table_id2').rows.add(response.data);
// table2 = $('#table_id2').draw();
$(document).ready(function() {
//datatables
table = $('#table_id').DataTable({
"lengthMenu": [[5, 10, 25, -1], [5, 10, 25, "All"]],
"deferLoading": 0,
"processing": true, //Feature control the processing indicator.
"language": {
"processing": "<span><img src='images/Preloader_3.gif'/></span>"
}, // you can put text or html here in the language.processing setting.
"serverSide": true, //Feature control DataTables' server-side processing mode.
"order": [], //Initial no order.
// Load data for the table's content from an Ajax source
"ajax": {
"url": "<?php echo base_url('infoemployee/ajax_list')?>",
"type": "POST",
},
//Set column definition initialisation properties.
"columnDefs": [
{
"targets": [ -1 ], //last column
"orderable": false, //set not orderable
},
],
}); });
答案 0 :(得分:2)
此块之后
"ajax": {
"url": "<?php echo base_url('infoemployee/ajax_list')?>",
"type": "POST",
},
添加以上行
"destroy" : true,