Is it possible to attach additional arrays/objects in the Ajax response?
Is it possible to attach additional arrays/objects in the Ajax response?
mass6
Posts: 7Questions: 3Answers: 0
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?
This discussion has been closed.
Answers
Sorry, put the wrong version down. It's in Version 1.10.2
The JSON object is passed into
initComplete
, so I would suggest accessing it there. Alternatively you could use the API:ajax.json()
.Allan