Configuring correctly for server-side processing...AJAX question.

Configuring correctly for server-side processing...AJAX question.

NJWebDesignNJWebDesign Posts: 7Questions: 3Answers: 0
edited August 2020 in Free community support

We are having a problem with a dataset contain thousands of rows and the speed in which it loads.
Looking through support here, it seems that we need to use the serverSideOption option, configured using the ajaxOption option (https://datatables.net/manual/server-side).

We are calling the rows using a mysqli connection which has to be set to call all of the rows, and our dataTable configuration is as follows.

<script>
        $(document).ready(function() {
    $.fn.dataTable.moment( 'DD/MM/YYYY H:ma' );
  var table = $('#myTable').DataTable( {
        order: [[ 2, "desc" ]]
    } );
} );    
</script>

What we do understand is that we would need to change the above script to:

<script>
        $(document).ready(function() {
    $.fn.dataTable.moment( 'DD/MM/YYYY H:ma' );
  var table = $('#myTable').DataTable( {
        order: [[ 2, "desc" ]],
        serverSide: true,
        ajax: '/data-source'
    } );
} );    
</script>

What we don't understand is the location of the Ajax data source? Our data source is a mysqli recordset on the page, so how do we convert it to be an Ajax data source?

Very new to this so please be gentle. Thank you.
NJ

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Answers

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

    It would be worth looking at the protocol here. Also see examples here. ajax will be the location of the script on the server, and that script will need the access for mysqli.

    Cheers,

    Colin

This discussion has been closed.