How to initialize DataTables with data already obtained ajax

How to initialize DataTables with data already obtained ajax

mrdevmrdev Posts: 5Questions: 0Answers: 0
edited December 2009 in General
Hello, I have a problem: in general, there is a tab, while clicking on the tab, I get the data ajax and put them in the table, and then want to tie dataTables, and swears that it does not see the data, decided to call $ ( "# myTable"). dataTable (); after receipt of data in the complete (Ajax), thought there take jquery.live, but it is not the type of event will not work, and the type of event where I do not need, how to get to see the data dataTable, and how to check have i instance or not

[code]
$.ajax({
type: “POST”,
cache: true,
url: host + “/includes/functions/bookmarkbody.php”,
data: “workpage=” + selectedTabID,
success: function(msg)
{
$(’#myTable’).html(msg);
},
complete: function()
{
$(”#myTable”).dataTable();
}
});

},
selected: -1
});
[/code]
Sorry for my English

Replies

  • mrdevmrdev Posts: 5Questions: 0Answers: 0
    (FF)javascript console show errors
    ??????: nThs is null
    ????????: http://mypm/public/js/jquery.dataTables.js
    ??????: 4669

    and

    ??????: sData is undefined
    ????????: http://mypm/public/js/jquery.dataTables.js
    ??????: 701
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi mrdev,

    Assuming that #myTable is the tag, I presume that 'msg' is along the lines of "......"? Otherwise you will run into problems. Aside for that, this would work fine. Do you have an example you can link to?

    Regards,
    Allan
This discussion has been closed.