News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

how to use ajax for module cart

Started by baoquocmt159, November 26, 2013, 05:30:26 AM

Previous topic - Next topic

baoquocmt159

Hi all
I'm used ajax for button Update quanty product in module cart, but not complate

My code :


var url="index.php?api_controller=checkout&api_ajax=update_form&id=5&quantity=3";

jQuery.ajax({
url:url,
type:'POST',
cache:false,
data:jQuery('#mod_ajax_form').serialize(),
dataType:'json',
success : function (rs){
requestUpdate false;
if(rs.error) {
//raise error msg
} else {
//process remove product task
if(task=='remove_product') {
jQuery('.marg-bot').destroy();
}
//end - process remove product task

//update cart module
if(VirtuemartVirtuemart.productUpdate(jQuery('.vmCartModule'));

//alert(rs.price.products);
//update product list
if(rs.price.products) {
for(var _id in rs.price.products) {
//update_DOM(vmconfig.show_tax, 'subtotal_tax_amount_'+_id, 'text',rs.price.products[_id].subtotal_tax_amount);
update_DOM(true'subtotal_discount_'+_id'text'rs.price.products[_id].subtotal_discount);
update_DOM(true'total''html'rs.price.products[_id].subtotal_with_tax);
}
}//end - update product list

update_DOM(true'prices''html'rs.price.billTotal);
                                                       or
jQuery('.prices').html(billTotal);
                                                       -> 
not complate

}//data

}

})//ajax


Please help me ! Thank you