При нажатий кнопки не работает ajax.. не могу понять почему... Код (Text): <button id="button-coupon" onClick="coupon1();">Применить</button> Код (Javascript): function coupon1() { $.ajax({ url: 'index.php?route=checkout/cart/coupon1', type: 'post', dataType: 'json', data: 'coupon=' + encodeURIComponent($('input[name=\'coupon1\']').val()), beforeSend: function() { $('#button-coupon').attr('disabled', true); }, complete: function() { $('#button-coupon').attr('disabled', false); }, success: function(data) { if (data['error']) { $('#button-coupon').attr('disabled', false); alert('Купон не принят!'); } if (data['success']) { $('#button-coupon').attr('disabled', false); $('#coupon1').hide('fast'); $('#coupon_div').addClass('active'); $('#coupon_ok').slideDown('slow'); $('#total_price').html('<span>Стоимость со скидкой :</span> <span id="total_price1"><b>'+data['total']+'</b></span> <s><?php echo $this->currency->format($this->cart->getSubtotal()); ?> </s>'); } } }); }
ничего... если вставить алерт после function coupon1() { то алерт выскакивает, получается не хочет работать ajax... --- Добавлено --- тьфу блин, забыл прописать / к ссылке) Теперь все работает