Whenever this code is running in a Force.com sites it will use JavaScript remoting