if I click heart icon to add product to wishlist it works (laravel and ajax ) but what’s the problem or what I have to check if I get 404 not found in console :
sorry but I don’t understand what you mean can you explain with exemple or code because I don’t know what to do ( sorry but I tried to see some tutorials and follow them to learn something new for me and to learn from my mistakes) and please advice me what to do if it happen again with other code thank you very much
wishlistController:
public function store(Request $request)
{
$product_id= $request->product_id;
if( Wishlist::where('user_id',auth()->id())->where('product_id',$product_id)->exists())
{
return response() -> json(['status' => "This Product is already in your wishlist "]);
}
else
{
$wishlist = new Wishlist;
$wishlist->user()->associate($request->user());
$wishlist->product_id = $product_id;
$wishlist->save();
return response() -> json(['status' => "Product added to wishlist"]);
}
thank you very very much veocode
I did what you said and I tried to:clear browsing data , php artisan cache:clear,php artisan view:clear,php artisan optimize ,restart wamp and I removed jquery code from products.blade.php and I tried to click heart button It always the same error appear I don’t know why and thank you very much and sorry
thank you very much veocode It works now and I tried to:clear browsing data , php artisan cache:clear,php artisan view:clear,php artisan optimize ,restart wamp and I removed jquery code from products.blade.php but I don’t know why It just works after I closed my PC and opened it again because it is not ideal to restart my PC every time I tried to fix code or change it with other code(when it dosen’t work) and thank you very very much