hy doesn't the ajax request pass the collation and search parameters to the server?

hy doesn't the ajax request pass the collation and search parameters to the server?

izumovizumov Posts: 178Questions: 14Answers: 0
edited May 2019 in Free community support

have a code

<head>
  <script  type="text/javascript" src="jquery-3.3.1.min.js" charset="utf-8"></script>
<script type="text/javascript" src="dataTables.js"></script>
<link rel="stylesheet" type="text/css" href="datatables.css"/> 
<script type="text/javascript" src="scriptdatatableclients311.js"></script> <!--создание таблицы плагина и связывания обработчика двойного клика-->
<script type="text/javascript" src="clientsfunction.js"></script>
</head> 
 
<body.>

<table id="clients"   class="display" style="width:100%" >
        <thead>
            <tr>
                <th>Kod</th>
                <th>LKod1c</th>
                <th>login</th>
                <th>Password</th>
                <th>name</th>
                <th>INN</th>
                <th>profit</th>
                <th>e_mail</th>
                <th>telefon</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                 <th>Kod</th>
                <th>LKod1c</th>
                <th>login</th>
                <th>Password</th>
                <th>name</th>
                <th>INN</th>
                <th>profit</th>
                <th>e_mail</th>
                <th>telefon</th>
            </tr>
        </tfoot>
    </table>

</body>
$(document).ready(function()

    {
    $('#clients').DataTable( {
         "order": [[ 0, "desc" ]],
         scrollY: true,
         scrollX:true,
    //   "sRowSelect": "single",
        "processing": true,
        "bPaginate": true,
        "bSort": true,
        "serverSide": true,
        "autoWidth":true,
        // "ajax": "proc.php"
        "ajax": "server_processingclients.php"
    } );
    $('#clients tbody').on('dblclick', 'tr', function () {
        var table =$('#clients').DataTable();
        var data = table.row( this ).data();
        document.location.href="http://localhost/client15.html?id="+data[0];
        //alert( 'You ID '+data[0]+'\'s row' );
    } );
//var oTable = $('#example').dataTable();

// Sort immediately with columns 0 and 1
//oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
} );

expect in an ajax request on the server side to receive collation and search and they do not come requests do not have any parameters.Tell me why this is happening.How to achieve the transfer of the required parameters?

EDIT: Updated using Markdown code formatting

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @izumov ,

    Is this a duplicate of this thread?

    Cheers,

    Colin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    this is not a duplicate, here we are talking about AJAX

  • kthorngrenkthorngren Posts: 21,470Questions: 26Answers: 4,977

    Please use code formatting so that your code is easier to read.

    Not sure I understand the problem description. Are you saying there is not an ajax request or that the ajax request does not have the server side parameters?

    Are you using the browser's developer tools to see the XHR request and response?

    Is the initial Datatable load working?

    A quick scan of the code it looks like it should work. Without actually seeing the web page with the problem its hard to say what is happening. Please provide a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    If you can't provide a link then try using the Debugger and providing the debugger code to Allan or Colin by sending them a PM.

    Kevin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    as far as I understand most likely when initiating datatables in the ajax section, I do not specify any parameters or options necessary for AJax to send sorting and search parameters in the request. so I ask how can I praavilno to set the initiation to the request sent the parameters, sorting and searching. now the server receives a request without any parameters and it is impossible to sort or search the server for this reason. All data is sent without sorting and they are successfully displayed I want to master sorting and search.

  • kthorngrenkthorngren Posts: 21,470Questions: 26Answers: 4,977

    You have "serverSide": true, which will use the protocol described here:
    https://datatables.net/manual/server-side

    This example shows the search and sort parameters being sent just by enabling "serverSide": true,. You can see the parameters being sent in the browser's developer tools:
    https://datatables.net/examples/server_side/simple.html

    Do you see these same parameters being sent from your Datatables in the developer tools?

    The code snippet above is not enough to troubleshoot. We need to see the problem happen in order to offer help. Please post a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    uxacoz

  • izumovizumov Posts: 178Questions: 14Answers: 0

    I have cited the debug code above. now you can tell me what the problem is why the parameters are not passed in the AJax request? I hope for your help.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited May 2019

    Hi @izumov ,

    Looking at that debug info, http://debug.datatables.net/uxacoz , the table contains three rows of data. As Kevin said, the searching and sorting requirements would've been sent as part of that Ajax request, as it's in the protocol, discussed here. I'm not clear what you're after, so please could you link to your page, or create a demo, with steps to reproduce the issue. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    благодарю за подсказки я нашел решение проблемы сейчас все работает и поиск и сортировка

This discussion has been closed.