Hi there, I am trying to integrate jQuery dataTables in my Laravel project but I can't seem to be able to do so.
I have this controller that I make an AJAX request to:
public function getMembers(){ $aaData = Member::take(1)->get(); return json_encode(array("aaData" => $aaData)); }
however, upon getting the request, my "aaData" variable holds an empty array. If I do return Member::all(); I do get my members to my client, but not when I put them in aaData. Otherwise, aaData is a must because datatables expects it.
Anybody please help. I thank you in advance for any help. Thanks
This made it work:
$aaData = Member::take(1)->get()->toArray(); return json_encode(array("aaData" => $aaData)); return $return;
thanks to bencohenbaritone for the solution provided in chat.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community