I want to get the output of JSON from the page select.php
and put each line in a <div id="estabelecimento">
with its attributes, I'm doing the following:
$.getJSON('select.php', function(data) {
$.each(data, function(index, element) {
$('#nome').html(element.nome);
$('#cidade').html(element.cidade);
$('#telefone').html(element.telefone);
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><divid="TodosEstabelecimentos">
<div id="estabelecimento">
<div id="nome">Nome</div>
<div id="cidade">cidade</div>
<div id="telefone">telefone</div>
</div>
</div>
But in the output only comes the first line with its attributes, I want the entire JSON result line to create a new div with id establishment and with its due attributes inside.