Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("body").on('click', ".add-to-cart", function(e) {
- e.preventDefault();
- $.ajax({
- beforeSend: function( xhr ) {
- $('.overlay-1').show();
- },
- url: 'add_to_cart',
- data: {id:'itemId'},
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
- }
- }).done(function(mes) {
- console.log(mes);
- });
- });
- // PHP
- 1. if(available_goods_with_id_of_id>1){
- available_goods_with_id_of_id--;
- }
- return 'success';
- $("body").on('click', ".remove-from-cart", function(e) {
- e.preventDefault();
- $.ajax({
- beforeSend: function( xhr ) {
- $('.overlay-1').show();
- },
- url: 'remove_from_cart',
- data: {id:'itemId'},
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
- }
- }).done(function(mes) {
- console.log(mes);
- });
- });
- // PHP
- 1. available_goods_with_id_of_id++;
- return 'success';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement