I have a page that uses jquery to turn an html table into a file structure using jquery treeTable plug in. The html table is in a div called "treeStructure"
I have the ability to add a new folder to any folder in the tree and I use a post call to add the new folder to the database. The post returns a new html table, with the added folder and replaces the "treeStructure" div's contents with the returned data. I then want to use the jquery to turn that table into the file structure again (like i did in the $document.ready() ), with out refreshing the page.
I think I need to use Jquery's .live() feature, but I can not figure out how to do this.
In the callback to your $.post
call, you can run the plugin on the data returned.
$.post('some/path', {some:'data'}, function( resp ) {
// create a jQuery object with the response
var $resp = $(resp);
// call the plugin
$resp.treeTable();
// append the result
$resp.appendTo('wherever');
});
If the table is nested deeper inside the response, you'll need to do a find:
$resp.find('#myTable').treeTable();