datatables jquery - 传递参数以调用ajax

时间:2016-03-31 15:32:02

标签: javascript datatables

我有一个包含三个隐藏列的数据表(例如:0,12,13)。这些列具有您需要作为ajax调用中的参数传递的索引信息。 我需要传递参数什么? 报告此参数的正确方法是什么?

$.ajax({data:RowColumnId_0:?????? , RowColumnId_12:??????, RowColumnId_13:?????? })

JS CODE

        $(document).ready(function() {

            $('#gridList').dataTable({
                bSort: false,
                aLengthMenu: [[10, 25, 50, -1], [10, 25, 50, "Todos"]],
                iDisplayLength: 50,
                bPaginate: true,
                bJQueryUI: true,
                bFilter: true,
                sPaginationType: "full_numbers",
                aaSortingFixed: [[0, 'desc']],
                oLanguage: {
                    oPaginate: {
                        sFirst: "Primeiro",
                        sPrevious: "Anterior",
                        sNext: "Seguinte",
                        sLast: "Último"
                    },
                    sLengthMenu: "Mostrando _MENU_ Registros por pagina",
                    sInfo: "Total de _TOTAL_ Registro(s)",
                    sInfoEmpty: "",
                    sInfoFiltered: "",
                    sSearch: "Buscar",
                    sLoadingRecords: "Carregando...",
                    sProcessing: "Aguarde...",
                    sZeroRecords: "Nenhum Registro Encontrado"
                },
                columnDefs: [
                    { visible: false, targets: [0,12,13] },
                    {
                        targets: [-1],
                        mRender: function(data, full) {
                            if (data === "1") {
                                return '<div class="checkbox"><label><input type=\"checkbox\" checked value="' + data + '"></label></div>';
                            } else {
                                return '<div class="checkbox"><label><input type=\"checkbox\" value="' + data + '"></label></div>';
                            }
                        }
                    }
                ]

            });

            $('#gridList input[type="checkbox"]').click(function (e)
            {
                if (this.checked) {

                   $.ajax({
                        url: "/Compras/Confronto/AutorizaPedido",
                        data: { IdRowColumn_0:?????? , IdRowColumn_12:??????, IdRowColumn_13:?????? },
                        dataType: "json",
                        type: "get",
                        success: function (data) {
                            if (data.Sucesso){
                                toastr.success(data.Mensagem, "Pedido - Autorizado");
                            } else {
                                toastr.error(data.Mensagem, "Pedido");
                            }
                        },
                        complete: function () {}
                    });

            });

        });

0 个答案:

没有答案