I've called some data from php using AJAX, and the result if I code alert(data.a) looks like this...
({a:[{my_id:"34", name:"Dave"}, {my_id:"39", name:"Barry"}]} 
I'm not sure how to loop through this to extract the values.
My latest code...
for (var key in data.a)
{
 if (data.a.hasOwnProperty(key))
 {
   alert(key + " -> " + data.a[key]);
 }
}
... displays
0 -> [object Object]
and this displays the same too...
for (var i=0,  tot=data.a.length; i < tot; i++)
{
  for (var key in data.a[i]) 
  {
    if (data.a[i].hasOwnProperty(key))
    {
      alert(key + " -> " + data.a[i][key]);
    }
  }
}
What's the trick to looping through these results to extract the data for display?
If it helps, here's what I send at the end of my php...
$x['a'] = $myArray; 
echo json_encode($x);
Thanks for your time and help.

console.log(data.a);and you will know the structure[object ObjectName]. Useconsole.log. Your second loop is right!