Json Datatables服务器端代码

Json Datatables服务器端代码,json,datatables,Json,Datatables,我的表代码是 <table class="table responsive-table" id="sorting-advanced"> <thead> <tr> <th scope="col">Estado</th> <th scope="col" wi

我的表代码是

<table class="table responsive-table" id="sorting-advanced">
                <thead>
                    <tr>
                        <th scope="col">Estado</th>      
                        <th scope="col" width="5%" class="align-center hide-on-mobile">Registo</th>
                        <th scope="col" width="5%">Expiração</th>
                        <th scope="col" width="5%" class="align-center hide-on-mobile">Inserção</th>
                        <th scope="col" width="10%">Dominio</th>
                        <th scope="col" width="10%" class="align-center hide-on-mobile">Titular</th>
                        <th scope="col" width="15%" class="align-center hide-on-mobile">Morada Tit.</th>
                        <th scope="col" width="10%">Email Tit.</th>
                        <th scope="col" width="15%" class="align-center hide-on-mobile">Localidade Tit.</th>
                        <th scope="col" width="15%" class="align-center hide-on-mobile">Cód. Postal</th>
                        <th scope="col" class="align-center hide-on-mobile">Nome Ent.</th>
                        <th scope="col" class="align-center hide-on-mobile">Email Ent.</th>
                        <th scope="col" class="align-center hide-on-mobile">Nome Tec.</th>
                        <th scope="col" class="align-center hide-on-mobile">Email Tec.</th>
                        <th scope="col" width="10px" >IP</th>
                        <?php if ($_SESSION['update'] == '1'){echo '<th scope="col" width=20px>Black</th>';} ?>

                    </tr>
                </thead>
                <tbody>

                </tbody>

                <tfoot>

                </tfoot>
            </table>
但是当我装填的时候,桌子什么都没做。。。 中间只有一个白色的方块,没有任何负载… 如果我将sAjaxsource更改为allraedy工作的文件,它将显示结果,但输出JSON格式相同


有人知道为什么会这样吗(

我能想到的唯一一件事是,您是否从文档中发回了表创建的相同的sEcho

string sEcho从客户端发送的sEcho的未更改副本。 此参数将随每次绘图而更改(基本上是绘图 因此,实现这一点非常重要 出于安全原因,强烈建议您“强制”此 参数设置为整数,以防止跨站点脚本(XSS) 攻击

如果您总是使用相同的json进行响应,那么应该省略sEcho(并且知道省略它的危险性)

<script>

        // Call template init (optional, but faster if called manually)
        $.template.init();


        // Table sort - DataTables
        var table = $('#sorting-advanced'),
            tableStyled = false;

        table.dataTable({
            "iCookieDuration": 60*60*2 , 
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "http://pgcc.datasource.pt/beta/listas/whois.php",
            "sScrollX": "100%",
            "bScrollCollapse": true,
            'sPaginationType': 'full_numbers',
            'oLanguage': {
                    "sProcessing":   "A processar...",
                    "sLengthMenu":   "Mostrar _MENU_ domínios",
                    "sZeroRecords":  "Não foram encontrados resultados",
                    "sInfo":         "Lista de domínios | <button class=\"button compact green-gradient\" onClick=\"javascript: openModal();\">Adicionar</button>",     
                    "sInfoEmpty":    "Não foram encontrados resultados",
                    "sInfoFiltered": "",
                    "sInfoPostFix":  "",
                    "sSearch":       "Procurar:",
                    "sUrl":          "",
                    "oPaginate": {
                        "sFirst":    "Primeiro",
                        "sPrevious": "Anterior",
                        "sNext":     "Seguinte",
                        "sLast":     "Último"
            }
            },
            'sPaginationType': 'full_numbers',
            'fnDrawCallback': function( oSettings )
            {
                // Only run once
                if (!tableStyled)
                {
                    table.closest('.dataTables_wrapper').find('.dataTables_length select').addClass('select blue-gradient glossy').styleSelect();
                    tableStyled = true;
                }
            },

        });
            oTable = $('#sorting-advanced').dataTable();

            function fnShowHide( iCol )
            {
                /* Get the DataTables object again - this is not a recreation, just a get of the object */

                var bVis = oTable.fnSettings().aoColumns[iCol].bVisible;
                oTable.fnSetColumnVis( iCol, bVis ? false : true );

            }
            $(document).ready(function(e) {
                fnShowHide(1); 
                fnShowHide(3); 
                fnShowHide(5); 
                fnShowHide(6); 
                fnShowHide(8); 
                fnShowHide(9); 
                fnShowHide(10); 
                fnShowHide(11); 
                fnShowHide(12); 
                fnShowHide(13);
            });

    </script>


    <script>

        $('#mudar').change(function(){
            var valor = $(this).val(); 
            $.post('pesquisar.php',{valor: valor}, function(data){
            $('#pesquisa').html(data)
            });
        });

    </script>
{"sEcho":0,"iTotalRecords":"2","iTotalDisplayRecords":"2","aaData":[["1","2012-08-06 17:49:05","2012-08-07","2012-08-06","nuno.pt","Nuno Almeida","Rua dos Frades","nuno_ng21@hotmail.com","Seia","1231","Gonçalo Cabral","g.cabral@datasource.pt","Datasource","teste@hotmail.com","192.168.1.0","1"],["1","2012-08-06 17:49:05","2012-08-07","2012-08-06","rumonet.pt","Nuno Almeida","Rua dos Frades","nuno_ng21@hotmail.com","Seia","1231","Gonçalo Cabral","g.cabral@datasource.pt","Datasource","teste@hotmail.com","192.168.1.0","2"]]}