$newBasket = new Basket($previousBasket); $newBasket->addProduct($product, $product->id); Session::put('basket', $newBasket); $qtny = Session::get('basket') ? Session::get('basket')->quantity : 0; return response()->json(['added' => $qtny], 200);
$.ajax({ type: "GET", url: "/product/add-to-basket/"+id, dataType: "json", data: { id: id } }) .done(function(data) { //var ob = JSON.parse(JSON.strigify) $('#counter').html(data['added']); swal("Added to basket!"); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)