I have a route like this --
Route::put('avote', 'voteController@avote')->middleware('auth');
I want to access this route from a ajax send request.
When i use this code --
$data = {/* some data here */};
$.post("/avote", $data, function(result) {
$('#avote h2').html(result);
$('#avote a span').css('color', 'orange');
$('#avote a span').unwrap();
});
I get an error method not allowed
. I know that it is the problem of method I used (used post not put)
I question is, is there any way i can get the information from /avote
using ajax or any other scripts?
Please dont suggest me to change the route request from put
to post
or Any other way to protect the /avote
route
I used
Route::put()
beacuse i have a database update function in the route controller