in reply to CGI ... newbie

Your problem is this line:

print $html . "\n" ;

Should be

return $html . "\n";

Just look at the example in CGI::Ajax more closely.