Error after .load()

Error after .load()

washi4washi4 Posts: 3Questions: 0Answers: 0
edited December 2009 in General
Hi!

I'm building some kind of dataviewer in PHP.
For this, I first made a dropdown with all the tablenames. After selecting a tablename, a .load() function takes place. In the .load() function all tablecolumnnames are selected. Now the user can select which columns he wants to view.
After selecting the columns, another .load() takes place that actually reads the desired data from the database.
Now I would like to use DataTables to show that data the user selected.
Now, here is my problem:
Using firebug, he says: "nThs is null".

Here is the code I'm using to load the data from the database and initialising the "DataTables":
[code]
$.ajax(
{
type: "POST",
url: "_sandbox_table_draw3.php",
data: {selectedfields: selected_fields, selectedtable: table},
cache: false,
success: function(html)
{
$("#table_details").html(html);
},
complete: function()
{
$('#table').dataTable( );
}
});
[/code]

What the "_sandbox_table_draw3.php" loads is nothing dynamic at the moment, it's still plain HTML:
[code]



test
test
test
test
test
test
test





test
test
test
test
test
test
test



[/code]

When I get rid of the error I will workout the response.

Anyone having an idea how the solve the error?

Thanks!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi washi4,

    Interesting one. I've just put your HTML into my zero config example that I've got locally (
    http://datatables.net/examples/basic_init/zero_config.html ) and it works no problem at all. So I'd guess that there is something funny going on with the Ajax - but I can't see what it would be! Do you have a link you could provide showing an example of it not working?

    Thanks,
    Allan
  • washi4washi4 Posts: 3Questions: 0Answers: 0
    Yes the problem occurs after loading the data with Ajax.

    I can't show an online version, I'm working local. Maybe I can send you a .zip file?

    Thanks a lot!
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi washi4,

    Sure thing, if you sent me message using http://datatables.net I'll ping you back.

    Regards,
    Allan
This discussion has been closed.