I am looping through JSON results to build a page before adding it the the DOM
Depending on what is in the looped results I may want to add the contents of another file but its not adding. I'm trying it in a logical way but often not right!
To test, the file addme.php
contains one line which is html += 'hello';
var html = '';
var i=0, length=data.length, image;
for(; i<length; i++) {
image = data[i];
html += '<li>';
html += '<div id="holder'+image.itemID+'">';
if(image.comment){
$.get('/pages/includes/addme.php', { list_id:+image.list_id });
}
html += '<div class="row">'+image.comment+'</div>';
html += '</div>';
html += '</li>';
}
$('#display').append(html);
Can this be done? I know I can't use append as its not actually in the DOM yet at the point it needs adding