0

I am using Jquery datatable (Server-side) to show the contents of my table. I want to edit of the columns to render some html elements (span and a). However, instead of rendering to a link for example, it returns the raw code. This is my view

<table>
<tr>
  <th>League</th>
  <th>Match</th>
</tr>
</table>
 $('.server_table').DataTable({
            "processing": true,
            "serverSide": true,
            "ajax": "{{ route('getdata') }}",
            "columns":[
                { "data": "league" },
                { "data": "match" },

            ]
        });

My Controller

$query = DB::select(); //Runs query
return Datatables::of($query) 
->editColumn('match', function($query){
 $ratings = "default";
 return '<span data-toggle="modal" data-target="#'.$query->user_id.'"><a  onmouseover="bigImg(this)" data-toggle="tooltip" title="Click to view user\'s last 5 ratings!">'.$query->username. '['.ucfirst($ratings).']'.'</a>
</span>';
})->make(true)
shekwo
  • 1,411
  • 1
  • 20
  • 50

0 Answers0