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

javascript in apex class?


I have a button which executes some javascript. I need to expose this function via the api. 

Could I call the javascript in a apex? and then could I call the apex function via the api?


Best Answer chosen by Admin (Salesforce Developers) 

1. You can't call javascript functions from Apex.

Javascript rusn on the user browser while Apex runs on SFDC servers.


2. You can call apex functions via the if you define them as web services.