4
How to make a value that is in JS appear in html content?
app js.
// BUSCA OCORRENCIAS
$("#menuOcorrencia").click(function() {
var operacao = "selectOcorrencias";
$.getJSON("http://url.com.br/appOperacoes.php", {operacao:operacao,condominioID:condominioID}, function(selectOcorrencias){
for (var seOcor in selectOcorrencias){
document.write(selectOcorrencias[seOcor].ID_Ocorrencia + selectOcorrencias[seOcor].morador + "<br />");
}
});
});
part of the html that is in index.html
<div class="list-group widget uib_w_44 d-margins" data-uib="twitter%20bootstrap/list_group" data-ver="1">
<a class="list-group-item allow-badge widget uib_w_45" data-uib="twitter%20bootstrap/list_item" data-ver="1" id="btnOcorrenciaVer">
<h4 class="list-group-item-heading">Heading</h4>
<p class="list-group-item-text">List item</p>
</a>
</div>
The FOR should happen by listing the result that came from the BD.
Example:
In Heading would be the selectOcorrencias[seOcor].ID_Ocorrencia
and in List item would be selectOcorrencias[seOcor].morador
This DIV is unique, it’s like grouping all the lists. So:
Plays the "html" inside the loop for and gives append to display wherever.
– Rodrigo Mello