参数传递到sAjaxSource jQuery的数据表 [英] Passing arguments to sAjaxSource in jQuery datatables
本文介绍了参数传递到sAjaxSource jQuery的数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的工作 codeignitor
和我有一个问题。
I am working on codeignitor
and I have a problem ..
我有一个控制器功能的 details.php 的接收一个参数。
I have a controller function details.php which takes an argument.
function details($id){
$this->datatables
->select('product_id,original_amount,quantity')
->from('orders')
echo $this->datatables->generate();
}
现在,我需要即我想要的数据表是从显示观点称这让
Now I need to call this from views ie I want datatable to be display so
<script>
$(document).ready(function()
{
$('#example').dataTable
({
.....
....
'sAjaxSource' : 'admin/data/details',
....
......
});
</script>
所以在这里如何传递参数给sAjaxsource即$ id值....
so here how to pass arguments to the sAjaxsource ie $id value ....
推荐答案
fnServerParams
fnServerParams
<一个href="http://www.datatables.net/release-datatables/examples/server_side/custom_vars.html">http://www.datatables.net/release-datatables/examples/server_side/custom_vars.html
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "more_data", "value": "my_value" } );
}
} );
} );
这篇关于参数传递到sAjaxSource jQuery的数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文