-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.js
35 lines (35 loc) · 1.28 KB
/
cart.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$(".upQuantity").on("click",function () {
var product = $(this).data("pdctid");
var quantity = $(this).data("pqnty");
$.post("php/cart.php", { up: quantity, pid: product, upQuantity: 201 })
.done(function( data ) {
console.log(data);
$(".mainCart").load("cartComponent.php");
});
})
$(".downQuantity").on("click",function () {
var quantity = $(this).data("pqnty");
var product = $(this).data("pdctid");
$.post("php/cart.php", { down: quantity, pid: product, downQuantity: 201 })
.done(function( data ) {
console.log(data);
$(".mainCart").load("cartComponent.php");
});
})
$(".removeProduct").on("click",function () {
var pid = $(this).data("pid");
$.post("php/cart.php", { remove: pid, removeProduct: 201 })
.done(function( data ) {
console.log(data);
$(".mainCart").load("cartComponent.php");
});
})
$(".clearProducts").on("click",function () {
$.post("php/cart.php", { clearProducts: 201 })
.done(function( data ) {
console.log(data);
$(".mainCart").load("cartComponent.php");
});
})
var product_value = $("input[name='idp[]']").map(function(){return $(this).val();}).get();
$(".product_id").val(product_value)