sort table after ajax creates table using jquery plug-in tablesorter

sort table after ajax creates table using jquery plug-in tablesorter

Hi,

I'm having trouble to enable sorting on the table once the ajax creates the table dynamically. I have this form:
<form method="get" action="getTable.php" id="greeting-form">
        <div>
            <label for="skin_type_id">Enter your name:</label>
            <input id="skin_type_id" type="text" />
            <input onclick="passParam();" type="checkbox" />
            <input id="button" type="submit" value="Update table" />
        </div>
        <div id="table"></div>
    </form>

Here's the simple function:
function passParam(){
     var url = 'getTable.php';
     var pars = 'skin_type_id='+escape($F('skin_type_id'));
     var target = 'table';
     var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars});
     $(document).ready(function() {
        $("#myTable").tablesorter();
     });
}

The table loads fine but there it's not sortable. I read that the call to the tablesorter() after the ajax call. Which is what I've done but I still can't get it to work. Any help is appreciated.

Victor Kimura