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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -