Fix
This commit is contained in:
@@ -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('ОФОРМИТЬ ЗАКАЗ');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user