function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.
Ashish_SFDCAshish_SFDC
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!);
}
</apex:page>

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, 

https://developer.salesforce.com/forums?id=906F000000096LuIAI


Regards,
Ashish