javascript获取数组对象中字段的值

I everybody

in my codeigniter structure I have this array of object named $corsi

Array
(
    [0] => stdClass Object
        (
        [id] => 1
        [nome] => abcd
        [costo_mensile] => 5

    )

    [1] => stdClass Object
    (
        [id] => 2
        [nome] => efgh
        [costo_mensile] => 10
    )

)

I want to access this data with javascript or a function javascript its possibile ? can i get for example the field "nome" ?

im try with

echo "('rif_corso', $corsi, '', 'onChange="run();" id="corsi"')

an in a script:

document.getElementById("corsi").value

can something help me ? thanks a lot riccardo

You can echo the whole js program somewhere into your html:

For example just before your closing </body> tag (if its possible with CodeIgniter) or some other script injection technique)

echo "<script>"
echo "var someVar = " . json_encode($phpVariable) . ";";
echo "console.log(someVar);";
echo "</script>";
echo "</body>";

This is not the way of doing in some proper applications. Just for learning and understanding purposes.