This commit is contained in:
kirill.khorkov
2025-12-17 20:42:54 +03:00
parent f4f57bd153
commit 07289608e5
8 changed files with 7058 additions and 6395 deletions

View File

@@ -469,19 +469,23 @@ $(document).ready(function() {
url: 'api/process_order.php',
method: 'POST',
data: $(this).serialize(),
success: function(response) {
try {
const result = JSON.parse(response);
if (result.success) {
window.location.href = 'order_success.php?id=' + result.order_id;
} else {
showMessage('Ошибка: ' + result.message, 'error');
$('#submit-order').prop('disabled', false).text('ОФОРМИТЬ ЗАКАЗ');
}
} catch(e) {
showMessage('Ошибка обработки заказа', 'error');
dataType: 'json',
success: function(result) {
if (result.success) {
showMessage('Заказ успешно оформлен!', 'success');
setTimeout(function() {
window.location.href = 'cite_mebel.php';
}, 1500);
} else {
showMessage('Ошибка: ' + result.message, 'error');
$('#submit-order').prop('disabled', false).text('ОФОРМИТЬ ЗАКАЗ');
}
},
error: function(xhr, status, error) {
console.error('AJAX error:', status, error);
console.log('Response:', xhr.responseText);
showMessage('Ошибка сервера при обработке заказа', 'error');
$('#submit-order').prop('disabled', false).text('ОФОРМИТЬ ЗАКАЗ');
}
});
});