i've a problem when passwing values with ajax i have a plus and minus buttons and input when i use input it works well to pass the value but with plus or minus it not working it works only on one item and the other items take the same value of the first
<button class="entry number-minus" data-id="<?=$cartRowID?> " type="button"> </button>
<input type="hidden" name="itemSizesList" value="<?=$itemSizeList?>" />
<input id="itemid" type="hidden" name="submittedForm" value="<?=$cartItemdID?>_<?=$cartListCounter?>" />
<input type="hidden" name="itemID" value="<?=encrypt_decrypt("encrypt",$cartItemdID)?>" />
<input type="hidden" name="cartRowID" value="<?=encrypt_decrypt("encrypt",$cartRowID)?>" />
<input class="entry number " name="newQty" data-id="<?=$cartRowID?>" value="<?=$cartItemQty?>" style="margin-top: 1px; width:44px"/>
<button class="entry number-plus" data-id="<?=$cartRowID?>" type="button"> </button>
<input type="submit" class="button style-17" value="Remove" name="delete" />
<input type="submit" class="button style-15" value="Update cart" name="update" />
ajax code:
// WHEN - IS CLICKED
$(document).on('click', '.number-minus', function(){
var rowid = $(this).data("id");
var qty = $('.number').val();
// edit_data(eachItemSize, "eachItemSize");
$.ajax({
url:"update.php?rowid="+rowid+"qty="+qty,
method:"POST",
data:{rowid:rowid , qty:qty},
dataType:"text",
success:function(data){
alert(data);
}
});
});
// WHEN + IS CLICKED
$(document).on('click', '.number-plus', function(){
var rowid = $(this).data("id");
var qty = $('.number').val();
// edit_data(eachItemSize, "eachItemSize");
$.ajax({
url:"update.php?rowid="+rowid+"qty="+qty,
method:"POST",
data:{rowid:rowid , qty:qty},
dataType:"text",
success:function(data){
alert(data);
}
});
});