Activity › Forums › Salesforce® Discussions › How can we call a controller method from JavaScript in Salesforce? Salesforce® Discussions How can we call a controller method from JavaScript in Salesforce? Posted by Ratnesh on January 22, 2020 at 2:23 PM How can we call controller method from JavaScript in Salesforce? Marziya replied 6 years, 4 months ago 2 Members · 1 Reply 1 Reply Marziya Member January 22, 2020 at 2:37 PM Hello Ratnesh, Use apex:actionFunction within vf page and define “action” attribute to Function to call. For e.g <apex:actionFunction action=”{!displayMethod}” name=”displayMethod”/> here action=”{!displayMethod}” is my function name to call and within javascript call name attribute within action function according to your condition. Thanks. Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me