looping thought to output array not working

Alex Lord
Alex Lord used Ask the Experts™
on
The data

data

the source of data

$jrArr[$jrID] = array (
				  'id'=>$jrID,
				  'date'=>$getJourney['Date'],
				  'name'=>$getJourney['name'],
				  'info'=> empty($info) ? $getJourney['jrEvent'] : $info,
				  'step'=>$step
				);

Open in new window


	
		$response = array(
			'Result' => 'getJrDetails success',
			'jr' => $jrArr,
			'jrCount' => $jrCount
		);

Open in new window



my effort


for(i = 0; i < response.jr.length; i++){


                      var d = new Date(parseInt(response.jr['date'])*1000);
                                    var day = String(d.getDate());
                                    if(day.length == 1)
                                    {
                                        day = "0"+day;
                                    }
                                    var month = String(d.getMonth()+1);
                                    if(month.length == 1)
                                    {
                                        month = "0"+month;
                                    }
                                    var year = d.getFullYear();


                     html = html + '<tr id="jr-'+response.jr[i]['id']+'" name="'+response.jr[i]['id']+'">'
                              + '<td>'+day+'-'+month+'-'+year+'</td>'
                              + ' <td>'+response.jr[i]['name']+'</td>'
                              + '<td>'+response.jr[i]['step']+'</td>'
                              + '<td>'+response.jr[i]['info']+'</td>'
                              + '</tr>';
                 }

Open in new window


result is none lol so not sure.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
for (const [key, value] of Object.entries(response.jr)) { 
     
       var d = new Date(parseInt(value['date'])*1000);
                                    var day = String(d.getDate());
                                    if(day.length == 1)
                                    {
                                        day = "0"+day;
                                    }
                                    var month = String(d.getMonth()+1);
                                    if(month.length == 1)
                                    {
                                        month = "0"+month;
                                    }
                                    var year = d.getFullYear();
       
        html = html + '<tr id="jr-'+value['id']+'" name="'+value['id']+'">'
                              + '<td>'+day+'-'+month+'-'+year+'</td>'
                              + '<td>'+value['name']+'</td>'
                              + '<td>'+value['step']+'</td>'
                              + '<td>'+value['info']+'</td>'
                              + '</tr>';
       
       
       
       
 
   }

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial