Reputation: 17792
I have a simple datatable instance:
var table = $("#table-elem").DataTable({
...
"ajax": {
"url":Services.apiUrl,
"dataSrc": "data"
},
...
})
I need to access the "data" that was returned in ajax call. How can I do that? Expecting something like:
var ajaxJson = table.ajax.data()
//play with ajaxJson
Upvotes: 6
Views: 4169
Reputation: 1004
table.on('xhr', function() {
var ajaxJson = table.ajax.json();
alert(ajaxJson.data.length + ' row(s) were loaded');
});
Gives back the last loaded data, as per the documentation
Upvotes: 8