Javascript InnerHTML Table Issues with AJAX

by John H
~1 minute

If you need to use Javascript innerHTML to update an element on the page you may run into issues if the element is a table.  The correct way to updated the table element is through a <tbody> tag.  You can then give it an ID that you can get with your javascript.

Example

<tbody id="updatedContent"> </tbody>

Then you can pass <tr> and <td> data into the <tbody> using innerHTML.

This is the way you will have to update a table using AJAX. without this technique you won't be able to add or update a table's data with AJAX.

Source: StackOverflow - add rows to table with innerHTML

Related Articles

Simple HTML content fade in with JQuery

JQuery in the Head $( document ).ready(function() {...

John H John H
2 minutes

CryptoPHP issues with Wordpress

I just found out that my IP for this server has been listed with Spamhaus due to a cryptoPHP hack...

John H John H
~1 minute

Javascript searching through a string

[caption id="attachment_612" align="aligncenter" width="1000"] Searching a string in...

John H John H
4 minutes