ServerSide Processing - No data, no message

ServerSide Processing - No data, no message

matt tonksmatt tonks Posts: 3Questions: 2Answers: 0
edited October 2018 in Free community support

Hello there,

I'm currently trying to create a table using DataTables and process the data server side. However I'm running into problems where there are no errors in the console and no data in the table. I was wondering if anyone might be able to help

Server-side data format

{
"draw":0,
"recordsTotal":1,
"recordsFiltered":1,
"data":[{
    "id":"23",
    "user_id":"1",
    "group_id":"1",
    "title":"School Closed",
    "body":"The school is closed today due to the weather. Enjoy the down time.",
    "send_at":null,
    "created_at":"2018-10-03 09:57:38",
    "updated_at":"2018-10-03 09:57:38"
}],
"input":[]
}

JS code

let messageTable = $("#messageTable").DataTable({
    dom: '<"pull-left top"l>B<"pull-right top"f> t<"bottom"ip><"clear">',
    buttons: [{
        extend: 'pdfHtml5',
        className: "ml-3 btn btn-info"
    },
    {
        extend: 'excel',
        className: "btn btn-info"
    }],
    processing: true,
    serverSide: true,
    responsive: true,
    ajax: "http://localhost/inform.ly/table/messages",
    columns:[
        {
            data:"user_id"
        },
        {
            data:"title"
        },
        {
            data:"body"
        },
        {
            data:"created_at"
        },
        {
            data:"group_id"
        }
    ]
});

Answers

This discussion has been closed.