how to get response json data
how to get response json data
![vtxmg](https://secure.gravatar.com/avatar/4127dabbd19f6cd6d81657027960f412/?default=https%3A%2F%2Fvanillicon.com%2F4127dabbd19f6cd6d81657027960f412_200.png&rating=g&size=120)
I have included additional data in server-side but I couldn't find a way to get json response data in every ajax request.
This discussion has been closed.
I have included additional data in server-side but I couldn't find a way to get json response data in every ajax request.
Answers
so, if I understand you right, you are sending back extra data with each response. There are several ways to do this, the way I do it is usually with the dataFilter callback that looks something like
$("#example").DataTable({
...
ajax: {
url:"pathtoserver",
data:data,
dataFilter: function(resp) {
// deserialize resp if needed.
// peel off the exta data and pass it on
// make sure the data for the table is the way datatable expects it
return that data object for datatables use
}
},
,,,
});