I’ve never had to write XML data into a table.. I’ve always just populated a div so… maybe this is a dumb question but I’m just not getting it.
I’m running an AJAX query to an ASP page and retrieving rows of data. I want to write the data out in HTML table rows so my first thought is to use a div and innerHTML like I’m familiar with
XML return:
for i=etc..
myrows.innerHTML += <tr>
myrows.innerHTML += <td>1st record name</td>
myrows.innerHTML += <td>1st record address</td>
myrows.innerHTML += <td>1st record phone</td>
myrows.innerHTML += </tr>
(I’ve left out proper formatting since that’s not the issue)
<table>
<tr><th>Name</th><th>Address</th><th>Phone</th></tr>
<div id=myrows></div>
</table>
Well, a div sitting in between table tags is just going to break the table.
What’s the solution?