I am using datatable in my laravel app. What I want to achieve is to get DELETE action(student/{student}) using resource contoller. image of datatable
The best way I think is to make route in javascript, but doesnt know how to do that. Below my datatable page that override datatable default route so that delete.blade.php get called.
$('#table_id').on('click', '.editor_remove', function() { var data = $('#table_id').DataTable().row($(this).parents('tr')).data(); window.location.href = 'http://ift.tt/1RmCisd' + data.id + ''; );
my delete.blade.php page
@extends('template')
@section('content')
<h1>Delete Student</h1>
{!! Form::open([
'method' => 'DELETE',
'route' => ['student.destroy', $input->id]
]) !!}
{!! Form::submit('Delete this student?', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}
@stop
Sorry for my grammar
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire