dokładniej fragment kodu wystarczy postawić ifa czy checkbox jest checked
- Kod: Zaznacz cały
$(document).delegate('#button-payment-method', 'click', function() {
$.ajax({
url: 'index.php?route=checkout/payment_method/save',
type: 'post',
data: $('#collapse-payment-method input[type=\'radio\']:checked, #collapse-payment-method input[type=\'checkbox\']:checked, #collapse-payment-method textarea'),
dataType: 'json',
beforeSend: function() {
$('#button-payment-method').button('loading');
},
success: function(json) {
$('.alert, .text-danger').remove();
if (json['redirect']) {
location = json['redirect'];
} else if (json['error']) {
if (json['error']['warning']) {
$('#collapse-payment-method .panel-body').prepend('<div class="alert alert-warning">' + json['error']['warning'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
}
} else {
$.ajax({
url: 'index.php?route=checkout/confirm',
dataType: 'html',
complete: function() {
$('#button-payment-method').button('reset');
},
success: function(html) {
$('#collapse-checkout-confirm .panel-body').html(html);
$('#collapse-checkout-confirm').parent().find('.panel-heading .panel-title').html('<a href="#collapse-checkout-confirm" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><?php echo $text_checkout_confirm; ?> <i class="fa fa-caret-down"></i></a>');
$('a[href=\'#collapse-checkout-confirm\']').trigger('click');
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});