How to use a JavaScript variable inside Blade syntax? I'm getting an error:
Use of undefined constant buttonID
inded.blade.php
var t = $("#datatable").DataTable({
"order": [[ 1, 'asc' ]],
"ajax": "questions1/get-data",
"deferRender": true,
"processing": true,
sAjaxDataProp: "",
"columns": [
{ "data": "id" },
{ "data": "name" },
{ "data": "description" },
{ "data": "answers.[, ].name" },
{ "data": "campaigns.[, ].name" },
{ "data": "label" },
{
sortable: false,
"render": function ( data, type, full, meta ) {
var buttonID = full.id;
return '@can('delete', $question){!! Form::open(['method'=>'DELETE','url' => ['/admin/survey-details/questions', buttonID ],'style' => 'display:inline']) !!}{!! Form::button('<span class="glyphicon glyphicon-trash" aria-hidden="true" title="Delete Question" />', array('type' => 'submit','class' => 'btn btn-danger btn-xs','title' => 'Delete Question','onclick'=>'return confirm("Confirm delete?")')) !!}{!! Form::close() !!}@endcan';
}
}
],
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire