Вывести значение response['service'] получается а вот response['operation'][i] нет.
Можете помочь? Как в цикле выводить двумерку?(
success: function(response){
alert(response['service']) //Обычный массив
var otchet_li, i = 0;
for(var i in response){
var response_view = response['operation'][i], //Двумерный
otchet_box = '<li>' + response_view['id'] + '</li>';
if(i == 0){
otchet_li = otchet_box;
}else{
otchet_li += otchet_box;
}
i++;
}
$$("#service-otchet").html(otchet_li);
}
На стороне сервера, так:
if(isset($_POST['id'])){
$id = htmlspecialchars($_POST['id']);
$service = mysqli_query($connect,"select * from `service` where `id` = '$id'");
$total['service'] = mysqli_fetch_array($service);
$operation = mysqli_query($connect,"select * from `operation` where `id_service` = '$id'");
while($operation_array = mysqli_fetch_array($operation)){
$total['operation'][] = $operation_array;
}
}
echo json_encode($total, JSON_UNESCAPED_UNICODE);