lundi 23 novembre 2015

how to access specific objects in array

"id": 35,
"date": "2015-11-17",
"day": "Tuesday",
"shifts": [
{
"shift_no": 1,
"shift_start_time": "08:00:00",
"shift_end_time": "10:00:00",
"time_change_reason": "t",
}

{
"shift_no": 2
"shift_start_time": "08:00:00",
"shift_end_time": "10:00:00",
"time_change_reason": "t",
}

{
"shift_no": 3,
"shift_start_time": "08:00:00",
"shift_end_time": "10:00:00",
"time_change_reason": "t",
}
]

here is my array , and i want to access the shift_start_time , shift_end_time data using my ajax code, those two are under another array called shifts. pls advice me how to proceed

this is what i tried.

                      output +=

                                "<td>" + json_obj[i].id + "</td>" +
                                "<td>" + json_obj[i].date + "</td>" +
                                "<td>" + json_obj[i].day + "</td>" +
                                "<td>" + json_obj[i]['shifts'].shift_start_time +"</td>"+
                                "<td></td>" +
                                "<td></td>" ;




                        output += "</tr>";



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire