I have an object which contain parent and child in each parent then i want to draw it into jQuery append for put each object into ol for parent and li for child
I still have problem when i tried to loop the child
<div id="progress-body" role="main" class="container-fluid after-navbar row page-content" style="margin-top:-50px;margin-left:-120px;margin-right:-120px">
</div>
[{"shipment_id":10008,"vehicle_name":"NusaFleet-03","shipment_date":"\/Date(1682355600000)\/","shipment_number":"A-098837772","origin_geofence_code":"Home Panji","planned_departure_time":"\/Date(1682357400000)\/","departure_time":null,"progress":null,"driver_name":null,"detail":[{"shipment_destination_id":10010,"shipment_id":10008,"number":1,"destination_geofence_name":"Diratna HomeStay","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682359200000)\/","planned_departure_time":"\/Date(1682380800000)\/"},{"shipment_destination_id":10011,"shipment_id":10008,"number":2,"destination_geofence_name":"Kasipah","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682445600000)\/","planned_departure_time":"\/Date(1682445600000)\/"},{"shipment_destination_id":10012,"shipment_id":10008,"number":3,"destination_geofence_name":"pool tika","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682449200000)\/","planned_departure_time":"\/Date(1682449200000)\/"},{"shipment_destination_id":10013,"shipment_id":10008,"number":4,"destination_geofence_name":"temtrem","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682451000000)\/","planned_departure_time":"\/Date(1682452800000)\/"},{"shipment_destination_id":10014,"shipment_id":10008,"number":5,"destination_geofence_name":"pool tikas","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682458200000)\/","planned_departure_time":"\/Date(1682465400000)\/"}]},{"shipment_id":10009,"vehicle_name":"NusaFleet-01","shipment_date":"\/Date(1682355600000)\/","shipment_number":"000000092","origin_geofence_code":"pool tikas","planned_departure_time":"\/Date(1682362800000)\/","departure_time":null,"progress":null,"driver_name":"Sugito","detail":[{"shipment_destination_id":10015,"shipment_id":10009,"number":1,"destination_geofence_name":"Diratna HomeStay","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682442000000)\/","planned_departure_time":"\/Date(1682528400000)\/"},{"shipment_destination_id":10016,"shipment_id":10009,"number":2,"destination_geofence_name":"temtrem","arrival_time":null,"departure_time":null,"planned_arrival_time":"\/Date(1682622000000)\/","planned_departure_time":"\/Date(1682715600000)\/"}]}]
function getmilestone()
{
var fromDate = '@ViewBag.FromDateDelivery';
var toDate = '@ViewBag.ToDateDelivery';
var search = null;
$.ajax({
url: "/Shipments/GetMilestone",
type: "POST",
data: { fromDate, toDate, search },
dataType: "json",
success: function (resp) {
if (resp["model"] == "error") {
alert("error");
}
else {
var data = resp;
for (var i in data) {
//alert(JSON.stringify(data[i]));
//alert(JSON.stringify(data[i].shipment_number));
$('#progress-body').append(
'<ol style="color:white">'
+ '<li>'
+ '<span id="no_velivery" style="margin-top: -20px; position: absolute;margin-left:-40px">' + data[i].shipment_number
+ '</span>'
+ '<p id="idvehicle" style="margin-left: -40px">' + data[i].vehicle_name
+ '</p>'
+ '<p class="diplome"style="color:white">' + data[i].origin_geofence_code
+ '</p>'
+ '<span class="point">'
+ '</span>'
+ '<p class="description">' + "Test"
+ '</p>'
+ '</li>'
+ '</ol>'
);
}
}
}
});
}
Maybe someone can help me
Thank you
Ruben