I am working on a laravel project, i am trying to load my datatable, i wanna i have a column used for sending a post request, here is my script:
var datatable = $('#table').on('xhr.dt', function(e, settings, json, xhr) {
$("#loadingAnimation").hide();
}).DataTable({
ajax: {
url: "/xxxxxxxxx",
type: "POST",
dataType: "JSON",
},
columns: [
{
data: 'id',
name: 'id',
},
{
data: null,
"render":function(row, type, val, meta){
return `
<form method="post" action="/xx/yyy/"+${row[`id`]}>
@csrf
<button>send</button>
</form>
`;
return '';
},
"orderable": false
},
]
});
so in the render part, I wanna i can call the route(/xx/yyy/{id}), i tried to call "/xx/yyy/1" and it worked, but when i wanna tried to use the variable row[id] it cannot work, can you please help me to figure it out? Many THX!
Here is correct way of adding parameters in blade
<form method="post" action="/xx/yyy/{{$row['id']}}">
Then form here
</form>