The xajax class has a method to generate a javascript to be included in the document head.
I'm using something like:
<?php
require_once ("class/xajax/xajax.inc.php");
$xajax = new xajax();
// Your processes script file...
require("include/processes/xajax.common.php");
// Include js to the header
$xoopsTpl->assign("xoops_module_header", $xajax->getJavascript('xajax/'));
?>