I'm loading quite a bit of json data through a jquery/ajax/php get. When I get the data, I display it in some tables on a modal i pop up. And I do it sort of like this.
str1 = "<table class='line_item_order_info_table'>";
str1 += "<tr><td class='line_item_label' >";
str1 += "Order no.";
str1 += "</td></tr>";
str1 += "<tr><td class='line_item_data' id='order_number_td'>";
str1 += data.order_number;
str1 += "</td></tr>";
str1 += "</table>";
str1 += "</td>";
str1 += "<td>";
str1 += "<table class='line_item_order_info_table'>";
str1 += "<tr><td class='line_item_label'>";
str1 += "Order date";
str1 += "</td></tr>";
str1 += "<tr><td class='line_item_data'>";
str1 += data.order_date;
str1 += "</td></tr>";
str1 += "</table>";
//many, many more lines that look like this
$('#modal-div').html(str1);
Is this the best way to put this data into html via javascript? It's sort of difficult to keep track of like this. This much html, without any indentations anywhere to make it easier to read, is sort of painful to look at or try to find something in.
Grateful if you can point me in the direction of a better strategy! Thanks!