Can I get ajax success response when using datatable to show data?

Viewed 174

I am fetching some dynamic data depending upon some condition and getting back the datas as table data using datatable. enter image description here

in the picture above the filtering conditions are in the first row and I am getting back the result as the table from the second card in the picture. enter image description here

I want also open the above form and show the field value depending upon the response data. But I don't know how to show success function within datatable.

enter image description here

Here is the code for datatable fetch.

enter image description here

and this is the old code through which i was opening the form and showing the data. How can I do the same now using datatable? Thanks for the help in advance.

1 Answers

As data tables is only using the number of columns you have defined in the table, you can add some more information at the end of each row you return from the request. In this case you can add your success field. Then you can add a rowCallback to the table

https://datatables.net/reference/option/rowCallback

and in the callback you can check the sussess using data[x] where x is your column index.

Related