how to get response json data

how to get response json data

vtxmgvtxmg Posts: 1Questions: 1Answers: 0

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

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    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
    }
    },
    ,,,
    });

This discussion has been closed.