I am struggling with the JavaScript syntax needed to access elements from the following JSON data that has been returned by PHP/MySQL and then stringified.
The variable vehs
contains:
[[{"vehID":"8","vehGrpType":"CAR","vehSubGrp":"Alfa Romeo","vehTitle":"Alfa Romeo 6C","vehPeriod":"","vehDescrip":"","vehNotes":"","vehGallery":"0","vehGallPath":"","vehGallImgs":""}],[{"vehID":"9","vehGrpType":"CAR","vehSubGrp":"Alfa Romeo","vehTitle":"Alfa Romeo 75 (1985-92)","vehPeriod":"","vehDescrip":"","vehNotes":"","vehGallery":"0","vehGallPath":"","vehGallImgs":""}],[{"vehID":"10","vehGrpType":"CAR","vehSubGrp":"Alfa Romeo","vehTitle":"Alfa Romeo GTV (1995-2000) and Spider (1995-2006)","vehPeriod":"","vehDescrip":"","vehNotes":"","vehGallery":"0","vehGallPath":"","vehGallImgs":""}]]
I have attempted to loop through the data like this:
for (var veh in vehs) {
$('#selectDIV').append(veh['vehTitle'] + '<br>');
}
However, I am only getting the numbers 0, 1, and 2, which I assume are the indexes of the three entries.
I believe I am missing something about accessing associative arrays within array elements. I'm a bit stuck and unsure of what to try next.
Any guidance would be greatly appreciated as I know it should be a simple fix.
Thank you