patternjavascriptMinor
Creating rows from JSON data
Viewed 0 times
rowscreatingjsonfromdata
Problem
I am getting data from JSON and then create rows of it:
Is there any better way of doing it?
$.each(data.GetwebMethodResult, function (index, item) {
$("#TableABC").append(FunABC(item.aID, item.b, item.c, item.d, item.e, item.f));
});
function FunABC(a, b, c, d, e, f) {
var row =
"" +
" " +
" " +
" " + a + "" +
" " +
" " +
"";
return row;
}Is there any better way of doing it?
Solution
Not really. It hard to optimize something with little logic. You could do this instead:
But aside from that looks good!
var row =
" \
\
\
" + a + " \
\
\
";But aside from that looks good!
Code Snippets
var row =
"<tr class='Row' onclick=\"AnotherUnrelatedFunction('" + a + "' , '" + b + "', '" + c + "', '" + d + "', '" + e + "', '" + f + "')\> \
<div class='mr'> \
<td class='mc mci'> \
<div class='mcit'>" + a + "</div> \
</td> \
</div> \
</tr>";Context
StackExchange Code Review Q#38822, answer score: 3
Revisions (0)
No revisions yet.