This is my jQuery code which I am using to make an Ajax Request:
$(".rowClick tr").click(function()
{
var id = $(this).data("id");
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: 'example/',
type: 'POST',
data: {id: id},
})
.done(function() {
console.log("success");
});
})
This is the Route Code I have written:
Route::get('example/','example@exampleDetailController');
Whenever I am making an ajax request to post on this URL it gives me a 405 (Method Not Allowed).
Why is this error occurring?
type: 'GET',
– brennan