sar*_*ake 4 jquery web-services datatables
我从asp.net Web服务获取数据,我想知道是否有办法将数据(直接从Web服务在json formar中)传递到DataTables对象.我想做的事情如下:
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://localhost/WebService/GetData",
} );
} );
Run Code Online (Sandbox Code Playgroud)
是的,你可以这样做.这是你的意思吗?...将数据传递给服务器?
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../examples_support/server_processing.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "more_data", "value": "my_value" } ); // this line will give additional data to the server...
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json)
} );
}
} );
} );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18193 次 |
| 最近记录: |