function add(F){ x_populate(print1); } function print1(N1) { document.write(N1); document.write('Its Me'); } my $msub = sub { return 'Hey'; }; Sajax::rs_init(); Sajax::rs_register("populate",$msub); //followed by some other Sajax functions //calling add() function