You have edited a file
catalog/view/theme/default/template/extension/payment/cod.twig
Code: Select all
<input type="checkbox" id="confirm" class="confirm">
{{ text_checkbox }}
<div class="buttons">
<div class="pull-right">
<input type="button" value="{{ button_confirm }}" id="button-confirm" data-loading-text="{{ text_loading }}" class="btn btn-primary" />
</div>
</div>
<script type="text/javascript"><!--
$('#button-confirm').on('click', function() {
if (!$('#confirm').is(':checked')) {
alert('not checked');
return false;
}
$.ajax({
url: 'index.php?route=extension/payment/cod/confirm',
dataType: 'json',
beforeSend: function() {
$('#button-confirm').button('loading');
},
complete: function() {
$('#button-confirm').button('reset');
},
success: function(json) {
if (json['redirect']) {
location = json['redirect'];
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
//--></script>
If the option is not selected, an error message appears (not checked)
Then code is suspended ( button_confirm)
Remains (loading)
Can you help?
opencart 3.0.2
Theme : journal3