0
Basically I have to take the information in the bank and play on the screen, so I wanted to make a screen only with the ones of "Ratings" and that, when clicking on some button, will show me the trainings.
However, I’m not sure how to access the "Training" array (Follow a print_r of my data array)
Array
(
[0] => Array
(
[AvaliacaoId] => 1
[AvaliacaoNome] => a
[AvaliacaoDescricao] =>
[AvaliacaoTreino] => 1
[AvaliacaoTimeId] => 1
[AvaliacaoCategoriaId] => 1
[Treinos] => Array
(
[0] => Array
(
[TreinoId] => 1
[TreinoNome] => Fisico
[TreinoData] => 2015-10-09
[TreinoHorario] => 14:00:00
[TreinoTipo] => 1
[TreinoCategoria] => 1
[TreinoTimeId] => 1
[TreinoFinalizado] => 1
[TreinoTurno] => 1
)
)
)
)
In my view I’m with an AJAX that uses the response.content
to get the data. In the evaluation part would be response.content[i].AvaliacaoNome
, Now at practice I don’t know.
Any idea?
I suggest reading the guide How to create a Minimum, Complete and Verifiable example. Edit your question and add the JSON answer and JS methods used in return recovery and handling.
– Romulo
Is that a json? or you get it as plain text?
– rray
response.content[i].Treinos[j].TreinoId
?– Guilherme Lautert
@rray Actually I just made a print_r of the array that I am encoding in JSON, in my PHP. Just to get an idea straight, I’ll update with JSON there.
– LMaker
@Guilhermelautert tried this, but I can’t. It seems to be AJAX synchronization error. I’ll even create another question to treat this haha
– LMaker
This structure is an array in PHP:
$saida = $seuarray[0]['Treinos'][0];
in javascript, would be like this:var saida = collection[0].Treinos[0]
, where the output variable represents the training array. You can pull these "0" indexes, because from the looks of it you’re not using, you can do this with thearray_values()
.– Ivan Ferrer
Here is an example: http://www.viper-7.com/UXkJvW
– Ivan Ferrer
Here are the two examples: http://www.viper-7.com/ZivcDS
– Ivan Ferrer