I try to update data in laravel with ajax with put
method, when I echo request input the result is null, this is my ajax
let formData = new FormData();
formData.append('name', 'lorem ipsum'); // I want get this
$.ajax({
url : 'product/17',
method : 'put',
data: formData,
contentType: false,
processData: false,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success : function(res){
alert(res); // result is null
}
});
Route :
Route::resource('/product', 'ProductController');
Controller :
public function update(Request $request, $id){
echo $id; // result is 17
echo $request->input('name'); // result is null :(
}
I have been search and try other code but not work, how to solve it? thanks