I'm facing problem with laravel ajax i want to define url using laravel action() or route('page.destory') function with id . Ajax code is here
$(".delete").click(function(){
var id = $(this).data("id");
var token = $("meta[name='csrf-token']").attr("content");
$.ajax(
{
url: "{{action('Admin\Page\PageController@destroy')}}+id",
method: 'DELETE',
data: {
"id": id,
"_token": token,
},
success: function (data){
alert(data);
}
});
});
Laravel give me error Missing required parameters for [Route: page.destroy]
in web.php
Route::resource('page','PageController);
How can i pass id with that action of destroy. url should be look like http://example.com/admin/page/1. but i do not want to write url manually.Many Thanks in advance.
