javascript - Add To Cart link on jquery -
i have code in e-shop. change normal link jquery. link "add cart" performed in background.
this code:
<a rel="?{=result.tempvariant.id}" class="addtocart greenbtn" href="${system.baseurl}#{uri:koszyk/}addvariant/?{=result.tempvariant.id}?{if system.postdata.requestpostdata.creatortemplate}?creatortemplate=?{=system.postdata.requestpostdata.creatortemplate}?{endif}"> #{add cart} </a>
when click add cart link in shop, item added cart, page not reloaded. tryied add script, then, system add 12 items cart.
$('a').click(function (event) { event.preventdefault(); var url = $(this).attr('href'); $.get(url, function(data) { alert(data); }); });
Comments
Post a Comment