28
rated 0 times
[
30]
[
2]
/ answers: 1 / hits: 30839
/ 8 Years ago, mon, april 11, 2016, 12:00:00
When I add success function DataTable not fill up automaticly rows in table. When I remove success function everything is all right and datatable fill correctly data in table. I want to catch in response using getAccessMessageWithStatus message by status but if I do it like this datatable no filling rows. How I can do that?
$('#' + datatableName).DataTable({
destroy: true,
'bProcessing': false,
'bServerSide': true,
'ajax': {
'url': URL,
'data': filters,
beforeSend: function() {
loader.popup('show');
},
success: function(response) {
getAccessMessageWithStatus(response);
},
complete: function() {
$listContainer.show();
$containerChoiseColumnsFilter.show();
$(.containerRaportButtons).show();
getLastSearches();
getUses();
loader.popup('hide');
}
},
'sServerMethod': POST,
'columns': columns,
'order': order,
'responsive': true
});
Answers:
success: function(response) {
getAccessMessageWithStatus(response);
},
Or:
dataSrc: function(response) {
if (response.status == false) {
alert(response.msg);
return [];
}
return response.aaData;
},
More From » jquery