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
asadimasadim 

How to call Apex Web Services from JavaScript?

Hi,

 

We have a web service written in Apex that I'd like to access from a JavaScript-based page that is hosted on some server (i.e. not a visualforce page). Any ideas on how I can do that?

 

Thanks.

asadimasadim

Can this be done using the AJAX Toolkit? Or is the Toolkit only for s-controls and VF pages?

 

Thanks.

b-Forceb-Force

if you are try to calling outside of Salesforce ,

I think you can use toolkit also

you need to hit login call first and set SessioonHeader,

and then call your webservice by following  way

 

sforce.apex.execute ("YOURCLASSNAME", "WEBSERVICE_METHOD",{});

 

Thanks,

Bala