how to loop generate a html line to each object in a list
I need to create a table where each loop will populate the columns in an html table
obs. the parameter received in onSuccess
function is a xml return
function onSuccess(data) { var table = document.getElementBdyId("kaizens") var lstProjetos = data.d.results; $.each(lstProjetos, function (key, value) { $("#head").append("</th>"+value.Area+"</th>"); });
Html:
<div class="mytable"> <table class="table" id="kaizens"> <tr id="head"> <th>teste</th> </tr> </table> </div>
</th>
should be <th>
without the /
. because balise should be open without the /
and close with
function onSuccess(data) { var table = document.getElementById("kaizens") var lstProjetos = data.d.results; $.each(lstProjetos, function (key, value) { $("#head").append("<th>"+value.Area+"</th>"); });