KACKbIP
4 months ago

How to make incrementing and decrementing in ajax and jquery

Posted 4 months ago by KACKbIP
                                                                <input type="hidden" name="proid" value="{{ $pro->id }}">
                                                                <div class="input-group-button">
                                                                    <button class="button decrement" type="button" name="decr">-</button>
                                                                </div>

                                                                <input class="input-group-field" type="number" id="bx_3966226736_2425_quantity" name="quantity" value="{{ \Cart::get($pro->id) ? \Cart::get($pro->id)->quantity : 1  }}" min="1">

                                                                <div class="input-group-button">
                                                                  <button  class="button increment" type="button" name="inc" >+</button>


                                                                </div>
                                                            </div>

This is my view

public function addOneProduct($id){ $product = Product::where('id', $id)->first();

    \Cart::add(
        array(
            'id' => $product->id,
            'name' => $product->name,
            'price' => $product->price,
            'quantity' => 1,
            'attributes' => array(
                'image'  => $product->image,
                'discount' => $product->discount,
            ),

        ));

}

Please sign in or create an account to participate in this conversation.