'server responded with a status of 405 (Method Not Allowed)
when i press the add to cart button it is not working and in the console it is saying 405 method not allowed
$.ajaxSetup({
headers:{
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: "post",
url: "add-to-cart",
data: {
'product_id':product_id,
'product_qty':product_qty,
},
success: function (response) {
swal(response.status);
}
});
});
Route::middleware(['auth'])->group(function () {
Route::post('add-to-cart', [CartController::class, 'addProduct']);
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
