3
I have the following array in PHP
Array
(
[0] => Array
(
[Funcionarios] => Array
(
[id] => 3
[nome] => Funcionario Teste
[assistmed] => 10
[assistodont] => 1
)
)
[1] => Array
(
[Funcionarios] => Array
(
[id] => 1
[nome] => Paulo Teste 2
[assistmed] => 2
[assistodont] => 2
)
)
I need to turn him into JS.
I tried to
js_arr = JSON.parse('<?php echo JSON_encode($funcionarios2);?>');
And I would like to handle it with js. However I can’t get the data, I tried the following commands:
alert(js_arr.id[0]);
alert(js_arr[id][0]);
What’s the right way?
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero