I am still learning Laravel 4 so I have a resourceful controller tasks and I am having a problem implementing my jquery.
My delete works fine without jquery so i think that I am not providing the proper url
I have found one problem I don't know how to pass my id to jquery,it apears that is not assigned.
$('#delete').on("click",function(event) {
event.preventDefault();
var answer = confirm('Are you sure you want to delete this?');
if (answer===true)
{
$.ajax({
url: 'tasks/'+id,
type: 'POSt',
success: function(result) {
// Do something with the result
}
});
}
else
{
return false;
}
});
My view with the delete part
{{ Form::open(array('method'=>'DELETE', 'route'=>array('tasks.destroy', $t->id))) }}
{{Form::submit('Delete',array('class'=>'btn btn-danger','id'=>'delete'))}}
{{Form::close()}}
Thank you for your help