Hello,
I can add a product to cart via GET with this link:
<div id="add"><a id="add-link" href="http://localhost/catalog/cart?product_id=8&boutique_id[]=36&func=Module::Cart->add">Add to Cart</a></div>
I want to use jQuery Ajax to stay on the same page (if JS is enabled). I have crapped out the following, but of course it does not work. Could someone please look what is wrong? Thanks.
<script type="text/javascript">
$(document).ready(function(){
$('a#add-link').bind("click", function(event) {
event.preventDefault();
var url = $(this).attr("href");
alert("Now I want to call this page: " + url);
$.ajax({
type: "GET",
url: "url="+url,
success: function() {
alert("Product added to cart");
}
});
});
});
</script>