我正在使用数据表作为我的产品视图,并且我在每个产品的末尾添加了购物车按钮以在 CART中添加产品当我点击添加到购物车按钮它将产品添加到购物车,按钮更改为查看购物车我通过使用 AJAX 并通过检查购物车数组{{1}中的域ID来完成所有这些操作} 这是Ajax
$this->cart->contents();
...它在桌面视图中工作正常,但当视图更改为小屏幕数据表变得响应时,如果我第一次点击添加到购物车按钮它变为查看购物车< / strong>但如果我点击数据表的 $.ajax({
type : 'POST',
url : base_url+'home/add',
data : {id:rowId},
beforeSend : function(){
thisElement.html('<i style="font-size:1em;" class="fa fa-spinner fa-pulse fa-3x fa-fw"></i> Add To Cart');
},
success : function(data){
if(data == 'true'){
$('.cart').notify("Domain Added To your Cart!" , "success");
var total_item = $('.total_items').html();
$('.total_items').html(parseInt(total_item)+1);
if(windowSize >= 1200){
thisElement.closest('td').html('<a href="'+base_url+'home/view_cart" class="btn cartBtn">View Cart</a>');
}else{
thisElement.closest('td ul li span:last-child').html('<a href="'+base_url+'home/view_cart" class="btn cartBtn">View Cart</a>');
}
}else{
swal("Warning!", "Something Went Wrong!", "warning")
}
}
});
});`
符号,则响应图标子td消失,再次查看购物车更改为添加到购物车按钮。
问题出在哪儿??怎么能解决?