Advertisement
Guest User

Untitled

a guest
May 5th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. $("body").on('click', ".add-to-cart", function(e) {
  2. e.preventDefault();
  3. $.ajax({
  4. beforeSend: function( xhr ) {
  5. $('.overlay-1').show();
  6. },
  7. url: 'add_to_cart',
  8. data: {id:'itemId'},
  9. headers: {
  10. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  11. }
  12. }).done(function(mes) {
  13. console.log(mes);
  14. });
  15.  
  16.  
  17. });
  18.  
  19. // PHP
  20. 1. if(available_goods_with_id_of_id>1){
  21. available_goods_with_id_of_id--;
  22. }
  23. return 'success';
  24.  
  25. $("body").on('click', ".remove-from-cart", function(e) {
  26. e.preventDefault();
  27. $.ajax({
  28. beforeSend: function( xhr ) {
  29. $('.overlay-1').show();
  30. },
  31. url: 'remove_from_cart',
  32. data: {id:'itemId'},
  33. headers: {
  34. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  35. }
  36. }).done(function(mes) {
  37. console.log(mes);
  38. });
  39.  
  40.  
  41. });
  42.  
  43. // PHP
  44. 1. available_goods_with_id_of_id++;
  45. return 'success';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement