(function() { $(document).on('click', '.show-add-to-cart-modal', function() { const modalRoute = $(this).data('cart-modal-route'); if (modalRoute) { $('#quick-view').modal('show'); const modalWrapper = $('#modal-body-wrapper'); const modalLoading = $('#modal-loading'); $.ajax({ url: modalRoute, method: 'GET', beforeSend: function() { modalWrapper.hide(); modalLoading.show(); modalLoading.addClass('d-flex'); }, success: function(response) { modalWrapper.empty().html(response); modalWrapper.show(); modalLoading.hide(); modalLoading.removeClass('d-flex'); }, error: function(err) { console.warn(err); } }); } }); })();