here i am calling multiple items to the shopping cart with a click and trying to direct them to the view cart cgi.
the adding multiple items works fine.
here is the script:
PHP Code:
<script type="text/javascript"><!--
$('.add-items').live('click', function(evt) {
if (evt.button != 0) return;
evt.preventDefault();
var items = $(this).attr('href').substr(1).split(',');
mySuccess();
function mySuccess() {
if (items.length > 0) {
addItemToCart(items.pop());
} else {
top.location.href = 'http://www.feelgoodlightups.com/cgi/cart.cgi?viewcart';
}
}
function addItemToCart(itemId) {
$(this).attr('disabled','disabled');
$.ajax({
url: '/cgi/cart.cgi?'+itemId,
success: mySuccess,
error: function() {
alert('Error occurred. Check the content of your cart.');
location.reload();
},
})
}
});
//--></script>