V
V
Valeriy19972015-06-22 22:18:32
JavaScript
Valeriy1997, 2015-06-22 22:18:32

How to correctly collect html elements from json?

function renderWorked(itemsi) {
$('#cases').append(' '); // create a div in which information with json will be added
var containered = $('.block'), html = [], i, item; // should add here
for (i = 0; i < itemsi.length; i ++) {
item = itemsi[i];
if($("div")){ if the code method is removed, then everything will be raked into one category
//-----collects html adding data from json
html.push(''); - inserts a div with the desired category
html.push('');
html.push(' '%20+%20item%5B'image-data'%5D%20%20+%20');
html.push(''+ item['title'] + '');
html.push('');
}
html.push('');
// html.push('');
}
}
var workItemsed = [ //json file
// categori_1
{'Wraper': '1','Category': 'Digital','data-video': '5n_aW-dPRIQ0', 'data-alt-src': '5n_aW-dPRIQ0', 'image-data': '5n_aW-PdRIQ0.jpg"', 'title': 'Digital
(example1)' },
// categori_2
{'Wraper': '2','Category': ' iron75','data-video': 'r3-K4vdvRe6E', 'data-alt-src':'r3-K4dvvRe6E', 'image-data': 'r3-K4vvdRe6E.jpg'', 'title': 'Digital
rill)' },
// Kategori_3
{'Wraper': '1','Category': 'tod123','data-video':
'Digital Digital' }, renderWorked(workItemsed); It turns out this markup: And you need to get it: one - that is, a category div, and everything in this category according to the json structure.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question