const form = '.contact-page__form';
$.ajax({
url: 'index.php?route=information/contact',
type: 'post',
data: $(form+' input, '+form+' textarea').serialize(),
dataType: 'html',
cache: false,
beforeSend: function() {
$('.contact-page__btn').button('loading');
},
complete: function() {
$('.contact-page__btn').button('reset');
},
success: function(html) {
const result = $(html).find('.text-danger');
if(result.length) {
if($('.basic-captcha').length) {
$.get('index.php?route=extension/captcha/basic/captcha');
$('.basic-captcha').html($(html).find('.basic-captcha').html())
}
result.each(function() {
form_error(form, $(this).text());
uniFlyAlert('danger', $(this).text());
});
} else {
window.location = 'index.php?route=information/contact/success';
}
}
});
});