datatable ajax重新加载传值,jquery datatable ajax重新加载更改事件

在下拉列表更改时加载数据表。在更改事件时,我想将下拉列表的值传递给新的ajax URL ..

// Dropdown on change event

$('#myDropdown').on('change', function(){

var myTable = $('#myDataTable').DataTable(); // get the table ID

// I want to call new ajax URL to get different data.

// How can I pass below options ?

"ajax":

{

"url": "/Product/GetProductData/5",

"type": "POST",

"dataType": "JSON"

},

myTable.ajax.reload();

myTable.ajax.draw();

});

正如上面的代码所解释的那样,我喜欢将下拉列表中的不同ID传递给ajax调用。这有可能吗?另外,我在initailisation document.ready上定义了列,但是我是否需要在change事件上重新定义它们?

更新:

以下代码实际上有所帮助。

$('#SelectedCustomerID').on('change', function () {

var customerID = $(this).val();

alert(customerID);

var table = $('#tbl_product_list').DataTable();

table.ajax.url("/Transaction/GetProductListData/" + customerID).load();

table.draw();

});