(05-09-2016, 06:55 AM)udin_ordinary Wrote: (05-08-2016, 12:36 PM)albertleao Wrote: Dude! Modularize your code! It's close to impossible to follow what is going on 
dear albertleao
here is the main code for increase and decrease the quantity, but its not working..
function minquantity(rowid){
var minquan = parseInt($('#txtquantity_' + rowid).val()) - 1;
if(minquan > 0) {
//alert(quan);
$.ajax({
type: "POST",
url: "<?php echo base_url();?>ajax",
data: { action: "product_model.update_cart", row_id: rowid, new_qty: minquan}
}).done(function( msg ) {
var total = parseInt(msg);
if(total > 0){
$('#cart_count').html(total);
$('#txtquantity_'+rowid).val(minquan);
}
});
}
}
function plusquantity(rowid){
var plusquan = parseInt($('#txtquantity_' + rowid).val()) + 1;
//alert(quan);
$.ajax({
type: "POST",
url: "<?php echo base_url();?>ajax",
data: { action: "product_model.update_cart", row_id: rowid, new_qty: plusquan}
}).done(function( msg ) {
var total = parseInt(msg);
if(total > 0){
$('#cart_count').html(total);
$('#txtquantity_' + rowid).val(plusquan);
}
});
}
dude you have to paste as a code block not just a simple text. Is almost impossible to detect the PHP in all that.
I do Front-End development most of the timeĀ