Evenly distribute data into columns with JavaScript
- by marius.cdm
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.