Instead of using
$("#container").empty().append(tableHTML);
you can just use
$("#container").html(tableHTML);
who will achieve the same. using plain old javascript may speed things up, but you will also need to remove any event handlers that you bound to the table with your code before deleting the old content, since jQuery usually handles this for you.
source share