sAjaxSource參數
Js代碼:
{
"aaData":
{
"columnA":"valueA"
"columnB":"valueB"
}
}
bServerSide參數
fnServerData參數
Js代碼:
/**
* @param {string} sSource HTTP source to obtain the data from (sAjaxSource)
* @param {array} aoData A key/value pair object containing the data to send
* to the server
* @param {function} fnCallback to be called on completion of the data get
* process that will draw the data on the page
* @param {object} oSettings DataTables settings object
*/
"fnServerData": function ( sUrl
oSettings
"url": sUrl
"data": aoData
"success": function (json) {
if ( json
oSettings
}
$(oSettings
fnCallback( json );
}
"dataType": "json"
"cache": false
"type": oSettings
"error": function (xhr
if ( error == "parsererror" ) {
oSettings
}
}
});
}
我們可以用這個參數來自定義ajax請求
服務器端之返回表格的數據對象
fnServerParams參數
Js代碼:
$(
"bProcessing": true
"bServerSide": true
"sAjaxSource": "scripts/server_processing
"fnServerParams": function ( aoData ) {
aoData
}
});
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20430.html