I am trying to build Jquery DataTables from a JSON result that is returned from an ASP.NET Web Api controller.
I am getting results on the initial page load, but when I click to sort columns, pagination, etc... there are no results. It is as if my DataTable is not able to load the JSON.
Here is my code, thanks in advance for any help offered:
var apiUrl = 'api/dockets?beginning_date=10/28/2013';
$(document).ready(function () {
$('#results-list').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/api/dockets"
});
// Send an AJAX request
$.getJSON(apiUrl)
.done(function (data) {
$.each(data, function (key, item) {
$('<tr><td>' + item.LastName + ', ' + item.FirstName + '</td><td>' + item.CaseNumber + '</td><td>' + item.CaseStatus + '</td><td>' + item.CourtSessionDate + '</td><td>' + item.CourtSessionStartTime + '</td><td>' + item.AppearanceReason + '</td><td>' + item.CourtRoom + '</td><td>' + item.OffenseDescription + '</tr>').appendTo("#results-list tbody");
});
});
});