Update cart using Ajax in Magento

var form = jQuery(“.cart-products form”);
jQuery.ajax({
url: form.attr(‘action’),
method: form.attr(‘method’),
data: form.serializeArray(),
async:false,
beforeSend: function(){
jQuery(“.cart-amount #chkbtn”).html(‘<img src=”‘+baseUrl+’ip-loader.gif”>’);
},
success: function(res){
var totalval =  jQuery(res).find(“.cart-amount input[name=’total’]”).val();
jQuery(“.cart-amount input[name=’total’]”).val(totalval);
jQuery(“.cart-final-price .right .price”).html(totalval);
jQuery(“.cart-amount #chkbtn”).html(‘CHECKOUT’);

}
});

Advertisements