简体   繁体   中英

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. 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

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

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

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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