0
I want to take JSON’s exit from the page select.php
and place each line in a <div id="estabelecimento">
with your attributes, I’m doing it this way:
$.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>
<div id="TodosEstabelecimentos">
<div id="estabelecimento">
<div id="nome">Nome</div>
<div id="cidade">cidade</div>
<div id="telefone">telefone</div>
</div>
</div>
However in the output I only get the first line with its attributes, I want the entire JSON result line to create a new div with id establishment and with its proper attributes inside.