I have a jquery script(downloaded from github) that deletes the entities. Following is the script.
$(document).ready(function() {
var restful = {
init: f
You have used method:DELETE
instead use following in your ajax
call
$.ajax({
headers: {...},
url: self.attr('href'),
type:"post",
data: { _method:"DELETE" },
success: function(data) {...},
error: function(data) {...}
});
Laravel
will look for the _method
in POST
and then the DELETE
request will be used if found the method.
Update: (Because of this answer, pointed by nietonfir
)
You may try DELETE
method directly like this (if it doesn't work then try the other one), :
$.ajax({
headers: {...},
url: self.attr('href'),
type:"DELETE",
success: function(data) {...},
error: function(data) {...}
});