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.08 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.  
  27.  
  28.  
  29. $("#buyButton").click(function(e) {
  30. e.preventDefault();
  31.  
  32. var buttonEl = $(this);
  33. var formEl = $('#productForm');
  34.  
  35. $.post(formEl.attr('action'), formEl.serialize(), function (){
  36.  
  37. buttonEl.addClass("buyButtonAnim");
  38. $("span", buttonEl).html("Přidáno, přejít do košíku?");
  39.  
  40. buttonEl.unbind('click');
  41. });
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement