How do I re-initialize DataTables. The ajax function loads the data from books.xml every 10 seconds.

How do I re-initialize DataTables. The ajax function loads the data from books.xml every 10 seconds.

yogesh516yogesh516 Posts: 1Questions: 1Answers: 0

The DataTable complains than I cannot re-draw DataTables.

Function to make ajax call every 10 Seconds.
function func1(){
$.ajax({
type: "GET",
url: "books.xml",
dataType: "xml",
async : false,
success: function(xml) {
$(xml).find('book').each(function(){
var Col0 = $(this).find('author').text();
var Col1 = $(this).find('title').text();
var Col2 = $(this).find('genre').text();
$('#test').append('<tr><td>'+Col0+'</td><td>'+Col1+'</td><td>'+Col2+'</td></tr>');
});
}
});
};

    $(document).ready(function(){
         func1();

    });

    setInterval(func2,10000);

    function func2(){
        $("#test").html("");
        func1();
    }

HTML Data:

Author Title Genre
Author Title Genre

Answers

This discussion has been closed.