Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
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

 Answers
39

Remove ; after the function name into the code.



success: function (response) {
getAccessMessageWithStatus(response)
},

[#62620] Friday, April 8, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lexusg

Total Points: 718
Total Questions: 106
Total Answers: 104

Location: Palestine
Member since Tue, Jul 20, 2021
3 Years ago
;