let form = $('#formOrder')
let name = $('#namePayment')
let phone = $('#phonePayment')
let action = $('#formOrder').attr('action')
// let btn = $('.cart__order-registration');
form.submit(function(e) {
e.preventDefault();
let nameValue = name.val();
let phoneValue = phone.val();
if (phone.val().length >= 10 && name.val().length >= 1) {
axios({
method: 'post',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
url: action,
data: {
name: nameValue,
phone: phoneValue
}
})
.then(function (response) {
console.log((response))
console.log(nameValue)
console.log(phone)
console.log('Отправлено')
phone.removeClass('error');
$('.msg-send').addClass('d-block')
})
.catch(function (error) {
console.log(error)
console.log('Ошибка')
})
}
if (phone.val().length < 10) {
phone.addClass('error');
}
if (name.val().length < 1) {
name.addClass('error');
}
});