简体   繁体   English

用URL重新加载jQuery数据表

[英]reload jquery datatable with url

var table;
$(document).ready(function(){
    table = $('#form_list').DataTable( {
        "ajax": '<?= base_url('report/get_form_report_data/'.$qc_form_id); ?>',
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    });
});

How can I reload this data table with new url. 如何使用新的URL重新加载此数据表。 I have been trying this: 我一直在尝试:

$('#division').change(function () {
    var qc_form_id = '<?php echo $qc_form_id; ?>';
    var actionUrl = '<?= base_url('report/get_form_report_data/') ?>'+qc_form_id;
    table.api().ajax.url(actionUrl).load();
});

But after changing the select box, showing an error: 但是更改选择框后,显示错误:

Uncaught TypeError: table.api is not a function 未捕获的TypeError:table.api不是函数

$('#division').change(function () { $('#division')。change(function(){

var actionUrl = 'your_url';
table= $('#your_table_id').dataTable();
 table.ajax.url(actionUrl).load();

}); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM