Laravel Ajax Post Request
let route = "{{ route('srcname') }}";
let token = "{{ csrf_token()}}";
$.ajax({
url: route,
type: 'POST',
data: {
_token:token,
name:'name',
email:'email'
phone:'09876767'
},
success: function(response) {
console.log(response)
},
error: function(xhr) {
//Do Something to handle error
}});
}
// laravel web
Route::post('srcname', [Controllername::class, 'filter'])->name('srcname');
// Controller
public function filter(Request $request){ return $request->name ;}
kazi web developer