denhamd2
12-15-2012, 01:45 PM
Hi,
I'm using jquery to make an Ajax GET call. Basically on my page I have 3 buttons to add products. What I want is for all 3 to be added to my shopping cart page at once. It works fine when I don't have a redirect and go to the cart page manually. The problem is when I add the redirect code, it only adds the first product. Any help on this problem would be much appreciated.
var dlink1 = $('a.addlink1').attr('href');
var dlink2 = $('a.addlink2').attr('href');
var dlink3 = $('a.addlink2').attr('href');
$('a.submitbutton').click(function() {
$.ajax({
type: 'GET',
beforeSend: function() {
if(dlink1 != '') { $.get(dlink1) }
if(dlink2 != '') { $.get(dlink2) }
if(dlink3 != '') { $.get(dlink3) }
},
success: function() {
window.location = '/cart.php';
}
});
return false;
});
I'm using jquery to make an Ajax GET call. Basically on my page I have 3 buttons to add products. What I want is for all 3 to be added to my shopping cart page at once. It works fine when I don't have a redirect and go to the cart page manually. The problem is when I add the redirect code, it only adds the first product. Any help on this problem would be much appreciated.
var dlink1 = $('a.addlink1').attr('href');
var dlink2 = $('a.addlink2').attr('href');
var dlink3 = $('a.addlink2').attr('href');
$('a.submitbutton').click(function() {
$.ajax({
type: 'GET',
beforeSend: function() {
if(dlink1 != '') { $.get(dlink1) }
if(dlink2 != '') { $.get(dlink2) }
if(dlink3 != '') { $.get(dlink3) }
},
success: function() {
window.location = '/cart.php';
}
});
return false;
});