It's worth to remember you must wait until the AJAX content is finished to call this function. Example:

$("#tablediv").load(document.location + " #table", function() {
sorttable.makeSortable(document.getElementById('table'));
});