У меня есть вопрос относительно моих кодов, у меня уже есть результат в моем ответе json с несколькими массивами. Единственная проблема - добавить результат в таблицу.
В моем ответе я хочу добавить select_order_details ктаблица, как использовать foreach, чтобы показать все результаты и добавить результат в таблицу.
My Html:
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr font-size: 14px; ">
<th scope="col">Menu Image</th>
<th scope="col">Menu Name</th>
<th scope="col">Quantity</th>
<th scope="col">Subtotal</th>
</tr>
</thead>
<tbody style=" font-size:14px;">
<tr>
<td></td>
</tr>
</tbody>
My Ajax Функция:
$('button#gather_customer_order').on('click',function()
{
var order_id = $(this).attr('data-order-id');
var customer_id = $(this).attr('data-customer-id');
$.ajax({
url:'/customer_detail_ordering_logic',
type:'GET',
data:{order_id:order_id,customer_id:customer_id},
success:function(response){
var response_customer_id = response[0].customer_details_id[0].customer_id;
var response_order_id = response[0].customer_details_id[0].order_id;
$.ajax({
url:'/fetch_detail_order_monitor',
type:'GET',
data:{response_order_id:response_order_id,response_customer_id:response_customer_id},
success:function(res){
console.log(res);
var select_order_details = response[0].select_order_details[0];
$.each(select_order_details, function(index, el) {
//For example
console.log(index + el)
})
}
})
}
})
});
Результат ответа: 