1
I got a comeback like JSON I’m trying to insert into the div, but it’s inserted all on top of each other.
<!-- DIV que vai receber as informações -->
<section>
<div class="conteudo">
<div class="foto"> FOTO </div>
<div class="inf"> TITULO </div>
<div class="inf"> DESCRICAO </div>
<div class="inf"> PRECO </div>
</div>
<div class="conteudo">
<div class="foto"> FOTO </div>
<div class="inf"> TITULO </div>
<div class="inf"> DESCRICAO </div>
<div class="inf"> PRECO </div>
</div>
My loop to try to fill the Divs
$("#menu li").click(function() {
var id = $(this).attr("id");
$.ajax({
type: 'GET',
url: "categoria/"+id,
contentType: "charset=utf-8",
}).done(function(output){
json = $.parseJSON(output);
$('.conteudo').empty();
$.each(json, function(i, items){
$('.conteudo').append(
items.fields['imagem'],+
items.fields['nome_produto']+
items.fields['descricao']+
items.fields['preco_produto']
);
});
});
return false;
});
I need to place the content of each json field in its respective div. I tried to insert id instead of css classes to identify. I also tried to use . append() methods. clone(), addClass(), appendTo but to no avail. If you can help me.
just a hint, you can do this using jsViews: http://www.jsviews.com/
– Tobias Mesquita