:::

5-8 resources\views\product\add2cart.blade.php

$('.btn-add-to-cart').click(function () {
    console.log($(this).data('id') + ' = ' + $('input[name=amount]').val());
    axios.post('{{ route('cart.store') }}', {
        product_id: $(this).data('id'),
        amount: $('input[name=amount]').val(),
    })
        .then(function () { // 請求成功時執行:
            swal('加入購物車成功', '', 'success').then(function() {
            location.href = '{{ route('cart.index') }}';
            });
        }, function (error) { // 請求失敗時執行:
            @guest
            swal('請先登入', '', 'error');
            @endguest

            @auth
            swal('系統錯誤', '', 'error');
            @endauth
        })
});

 


:::

書籍目錄

展開 | 闔起

http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D45%26tbdsn%3D1531

計數器

今天: 1356135613561356
昨天: 3438343834383438
總計: 7391685739168573916857391685739168573916857391685