Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. $("#buyButton").click(function(e) {
  2. e.preventDefault();
  3. var shpId = $("#id_shp").val();
  4. var amount = $("#amount").val();
  5.  
  6. var element = $(this);
  7.  
  8. $.post("/shop/add-to-cart", {id:shpId, amount: amount}, function (){
  9. element.addClass("buyButtonAnim");
  10. element.attr("href", "/e-shop/kosik");
  11. $("span", element).html("Přidáno, přejít do košíku?");
  12.  
  13.  
  14. $(".buyButtonAnim").click(function() {
  15. window.location = "/e-shop/kosik";
  16. });
  17.  
  18. });
  19.  
  20.  
  21. });
  22.  
  23.  
  24.  
  25.  
  26. $("#buyButton").click(function(e) {
  27. e.preventDefault();
  28.  
  29. var buttonEl = $(this);
  30. var formEl = $('#productForm');
  31.  
  32. $.post(formEl.attr('action'), formEl.serialize(), function (){
  33.  
  34. buttonEl.addClass("buyButtonAnim");
  35. $("span", buttonEl).html("Přidáno, přejít do košíku?");
  36.  
  37. buttonEl.unbind('click');
  38. });
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement