$obj = new Object();
$obj.surname = "smith";
$field_name = "surname";
alert($obj.$field_name); //error!!
Wth? How do I do this with js? I need to access all values in an object within a foreach but I can't manage to access obj proprerties by reference!