New to Datatable - Ajax Not Working

New to Datatable - Ajax Not Working

kmcnetkmcnet Posts: 5Questions: 2Answers: 0

Hello everyone and thanks for your help in advance. I am new to the jQuery datatable and am having problems connecting it to an Ajax datasource. Here is the HTML:

        <table id="myAjaxTable">
            <thead>
                <tr>
                    <th>MR Number</th>
                    <th>DOB</th>
                    <th>Last Name</th>
                    <th>First Name</th>
                </tr>
            </thead>
            <tbody>

            </tbody>
        </table>

The code to making the Ajax call:

        $('#myAjaxTable').DataTable(
            {
                "processing":  true,
                "serverSide": true,
                "ajax": "../api/Claim/GetUnpaidClaims",
                "columns": [
                    { "data": "MRNumber" },
                    { "data": "FirstName" },
                    { "data": "LastName" },
                    { "data": "DOB" }      


                ]

            }
            );

And the JSON data:

```
[{"MRNumber":"5732","FirstName":"Sam","LastName":"Smith","DOB":"01/01/1959"},
{"MRNumber":"1234","FirstName":"Tom","LastName":"Smith","DOB":"01/01/1961"},
{"MRNumber":"4567","FirstName":"Rob","LastName":"Smith","DOB":"01/01/1993"},
{"MRNumber":"3456","FirstName":"Sally","LastName":"Smith","DOB":"01/01/1995"},
{"MRNumber":"3456","FirstName":"Sue","LastName":"Smith","DOB":"01/01/2001"}]

I have verified through the developer console that this data is returned from the WebApi2 call, but the datatable says "processing". Any help would be appreciated.

This discussion has been closed.