Basic ajax DataTable configuration help

Basic ajax DataTable configuration help

blarsonblarson Posts: 2Questions: 1Answers: 0
edited January 2016 in Free community support

I'm trying to use DataTables with php and mysql. I have an ajax call that is pulling in data as such:

[
    {
        “id"3,
        "ptid":"blah",
        "last_name":"blah",
        "first_name":"blah",
        "priv_application":"E",
        "priv_document":"E",
        "priv_note":"E",
    }
]

I'm configuring DataTables with the following:

$('#listing').DataTable( {
    "paging": false,
    "searching": false,
    "select": true,
    ajax: {
            url: '{{ url("administration/admindata") }}',
            dataSrc: ''
     },
     columns: [
                { title: "ID" },
        { title: "PtID" },
        { title: "Last Name" },
        { title: "First Name" },
        { title: "Application" },
        { title: "Documents" },
        { title: "Notes" }
         ]
});

And the HTML for the table is as follows:

<table id="listing" class="display" width="100%"></table>

However, it doesn't want to load the data even though this configuration is exactly like the first example given here: https://datatables.net/manual/ajax

I'm getting the following error:

DataTables warning: table id=new-search-members-listing1 - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4

Any assistance is greatly appreciated.

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

Answers

This discussion has been closed.