Them I click the subscribe button it gives me error messages below
MethodNotAllowedHttpException
but I already define the method in the route file
Route::post('/emailsub','EmailSubController@emailsub');
The Controller Part are here
public function emailsub(Request $request){
$data = new EmailSub;
$data->email = $request->email;
$data->save();
return $request->all();;
}
Here is the Html Code Of my form
<form method="POST" >
{{csrf_field()}}
<input type="text" id="email" placeholder="email" required="">
<input type="submit" id="subbtn" value="Subscribe">
</form>
Here Is the Ajax part
$('.button').on('click','#subbtn',function(){
$.ajax({
type: 'post',
url: "emailsub",
data:{
'email':$('#email').val(),
'_token':$(input['name=_token']),
},
success: function (data) {
$('#subbtn').val("Unsubscribe");
},
});
});