<i id="wishlist;?>" onclick="wishlistSubmit('productid')" class="fa fa-heart fa-fill" style="font-size:35px;color:<?php if(!$whishlist) {echo "red";}else{echo "green";} ?>;)"></i>
<script>
function wishlistSubmit(productid){
var color = $("#wishlist_" + productid).css("color");
alert(color);
var ajaxfile = "product_wishlist_remove.php";
if(color === 'rgb(255, 0, 0)'){
ajaxfile = "product_wishlist.php";
}
$.post(
"<?php echo $base_path; ?>/lib/ajax/" + ajaxfile,
{'product_ID': productid},
function(data) {
alert(data.message);
if(color === 'rgb(255, 0, 0)'){
$("#wishlist_" + productid).css("color", "green");
}else{
$("#wishlist_" + productid).css("color", "red");
}
}
);
}
</script>
No comments:
Post a Comment