Answer the question
In order to leave comments, you need to log in
Return multiple Json ajax values?
JavaScript:
$.ajax({
url: '../ajax/pay.php',
type: 'POST',
cache: false,
data: {'orderNumber': orderNumber},
dataType: 'html',
success: function (data) {
data = JSON.parse(data);
if(data[0] > 0) {
$('#orderPay').text('Подождите...');
alert(data[1]);
alert(data[2]);
} else {
$('#errorBlock').show();
$('#errorBlock').text(data[1]);
}
}
});
});
echo json_encode(array(1, $orderId));
echo json_encode(array(2, $summ));
echo json_encode(array(3, $title));
echo json_encode(array(4, $description));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question