+ Start a Discussion
Venkat PenukondaVenkat Penukonda 

Javascript remoting from a site.com community page

I am planning to use site.com pages for community. In that case, I need to use javascript in the page to call web services defined in apex classes. 

I know from VF community pages, I can set the apex class as controller, and then make a javascript call from VF page to the web service. But in site.com community page, obviously there is no way to define controller. So, how to call the web service from site.com pages?

Any clarifications in this regard are highly appreciated.
Hi Venkat, 

The only way to get the Javascript executed is through a Visualforce page. 

There are a two ways that I can see to do this:

1. Put all your JS into a VF page:

<apex:page contentType="text/javascript" cache="false" expires="0">
function MyScript() {
     alert('Yahoo! No more static resource uploads!);

And expose that page via sites.

2.  If you click on the download link for a static resource (and you select the checkbox that makes the static resource publicly accessible) you'll get the url that it's served from. This URL won't change for a specific resource.

See more information in the similar thread,