Your current code ends up with an additional opening
tr tag at the end, which might be causing the whole thing to collapse into one column. My code should remove this extraneous opening tag.
I've revised it here as I assume there is already a closing
table tag somewhere.
Code:
var tblContent = '';
tblContent += // etc..;
tblContent = tblContent.substring(0, tblContent.length-5);
But this might not be the problem; you may just be inserting the content in the wrong place.