close
參考自 https://stackoverflow.com/questions/15786572/call-a-function-in-success-of-datatable-ajax-call
--
使用datatable ajax下面的dataSrc參數
此callback function相當於success的callback func,當success要做甚麼事都寫在這裡
另外,return 內容就是datatable的data來源
使用方式如下:
Here is a typical example of datatables.net
var table = $('#example').DataTable( {
"ajax": {
"type" : "GET",
"url" : "ajax.php",
"dataSrc": function ( json ) {
//Make your callback here.
alert("Done!");
return json.data;
}
},
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );
--
全站熱搜
留言列表