Is it possible to attach additional arrays/objects in the Ajax response?

Is it possible to attach additional arrays/objects in the Ajax response?

mass6mass6 Posts: 7Questions: 3Answers: 0
edited December 2015 in DataTables 1.10

In my controller, I'm sending the the ajax "data" payload as such:

return Response::json(['data' => $data]);

That works fine, but i'd like to send additional data set along with the ajax payload, such as:

return Response::json(['data' => $productRequests, 'moreData' => $moreData]);

How would I then retrieve the 'moreData' object from within my JS? is this possible?

Answers

  • mass6mass6 Posts: 7Questions: 3Answers: 0

    Sorry, put the wrong version down. It's in Version 1.10.2

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    The JSON object is passed into initComplete, so I would suggest accessing it there. Alternatively you could use the API: ajax.json().

    Allan

This discussion has been closed.