I am using jquery datatable serverside ajax, secho is null

I am using jquery datatable serverside ajax, secho is null

tnomanitnomani Posts: 1Questions: 1Answers: 0

{ sEcho = null, iTotalRecords = 132, iTotalDisplayRecords = 10, aaData = {System.Linq.OrderedEnumerable`2[LWOBPortal.Models.Product,System.String].Skip(0).Take(10)} }

theviewis

<link rel="stylesheet" href="https://cdn.datatables.net/2.0.0/css/dataTables.dataTables.css" />

<script src="https://code.jquery.com/jquery-3.7.1.js"></script>

<script src="https://cdn.datatables.net/2.0.0/js/dataTables.js"></script>

<script>
    $(document).ready(function () {
        $('#tblProduct').DataTable({
            "processing": true,
            "serverSide": true,
            "ajax": {
                "url": "/Product/GetData",
                "type": "POST",
                "iDisplayStart": 1,
                "iDisplayLength": 10,
                "success": function (d) {
                    console.log(d.data[0].id_documento);
                },
            },
            "columns": [
                { "Data": "productName" },
                { "Data": "rate" },
                { "Data": "price" },
                { "Data": "lockPeriod" },
                { "Data": "productType" }
                // Add other columns as needed
            ]
        });
    });
</script>

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    Looks like your server side processing script supports Datatables 1.9 based on the documented SSP parameters. Starting with Datatables 1.10 the parameters have changed as documented here. You will need to update your server side processing script to support these parameters or use Datatables supplied scripts - see this blog.

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Yes, that is one of the few breaking changes in DataTables 2. It removes a fair amount of the legacy stuff from 1.9 and earlier - specific the Hungarian notation for server-side processing and the legacy API.

    Allan

Sign In or Register to comment.