My AJAX request responds with the following data in string format:
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
I want to append this HTML to an existing table.
<table id="demo">
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
<tr> <td>data</td> <td>data</td> <td>data</td> </tr>
</table>
I have already selected the table element from the DOM.
const table = document.getElementById('demo');
I would like to be able to do something like the following, but of course that is not possible using the appendChild method.
table.appendChild(xhr.responseText);
Is what I'm working to accomplish possible using only the DOM (without the use of libraries), and if so how can I go about using it properly?