我是新來Ajax.I有一個jQuery的dataTable的一個RoR app.I必須參數傳遞給按鈕,這樣我可以選擇的動作當按鈕被點擊時被執行。
var invoiceTable = $('#invoice_list_index').DataTable({
"scrollY": "300px",
"bScrollCollapse": true,
processing: true,
serverSide: true,
dom: 'Bfrtip',
buttons: [
{
extend: 'alert',
text: 'My button 1',
},
{
extend: 'alert',
text: 'My button 2'
},
{
extend: 'alert',
text: 'My button 3'
}
],
"ajax": {
type: "POST",
url: '/invoices/invoice_index_page',
}
});
<a class="dt-button buttons-alert" tabindex="0" aria-controls="invoice_list_index" href="#"><span>My button 1</span></a>
的問題是我不知道如何將參數傳遞到AJAX自定義按鈕。
你想傳遞給這些按鈕動作的參數是什麼?那些錶行數據還是其他? –