参数传递到sAjaxSource jQuery的数据表数据表、参数、sAjaxSource、jQuery

由网友(少年,不再年少)分享简介:我的工作 codeignitor 和我有一个问题。I am working on codeignitor and I have a problem ..我有一个控制器功能的 details.php 的接收一个参数。I have a controller function details.php which tak...

我的工作 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

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" } );
        }
    } );
} );
阅读全文

相关推荐

最新文章