Evenly distribute data into columns with JavaScript
Posted
by
marius.cdm
on Stack Overflow
See other posts from Stack Overflow
or by marius.cdm
Published on 2013-10-19T21:47:09Z
Indexed on
2013/10/19
21:54 UTC
Read the original article
Hit count: 193
I'm looking for a way to evenly distribute my JSON data into HTML columns.
Using javascript to pull the data
$.ajax({
url: "url",
dataType: 'json',
data: "e="+escape(divID),
cache: true,
success: function(data) {
var items = data;
// ???
$('.result').html(list);
}
});
Input data:
["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"]
Expected result:
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
</ul>
<ul>
<li>E</li>
<li>F</li>
<li>G</li>
<li>H</li>
</ul>
<ul>
<li>I</li>
<li>J</li>
<li>K</li>
</ul>
I found a partial result here, but the output data is in console.
Any help would be appreciated.
© Stack Overflow or respective owner