1
I believe my question has become too superficial, but I explain the situation in more detail:
I already have the code and it works partially follows;
$(document).ready(function() {
var url = "dominio.com/json.php";
$.getJSON(url, function(result) {
console.log(result);
$.each(result, function(i, field) {
var id_rotina = field.id_rotina;
var treino = field.treino;
var grupo_id = field.grupo_id;
var user_id = field.user_id;
var id_grupo = field.id_grupo;
var nome_grupo = field.nome_grupo;
var anatomia = field.anatomia;
var id_exercicio = field.id_exercicio;
var nome_exercicio = field.nome_exercicio;
var repeticoes = field.repeticoes;
var intervalo = field.intervalo;
if(treino == 'treino-b'){
$("#grupo-b").append(
"<div class='serie'> <div class='mostra-grupo-b'>"
+ nome_grupo
+ "<div class='visualizar'>VER</div>"
+ "</div>"
+ "<div class='anatomia'>" + anatomia + "</div>"
+ "<table class='grupo-b' align='center'><thead><td class='exe'>Exercício</td><td>Reps</td><td>Int</td></thead><tbody>"
+ "<td>"+ nome_exercicio +"</td>"
+ "<td>"+ repeticoes +"</td>"
+ "<td>"+ intervalo +"</td>"
+ "</tbody></table></div>");
}
});
});
});
it prints correctly when it only has one element to print when it has more than one it duplicates the variable 'groupname' and table.
my question really is: How do I show on the screen the variables correctly ?
in this case the group name does not repeat what repeats is thead where it has (Reps) and (Int) .. I would like to know if this code as it is is possible to dynamically display the group name and assign to this group name dynamically the (exercise name) etc without repeating thead only when necessary in case of displaying a (group name) different .. (with the appropriate changes of course). Thank you for responding..
– jardel frank