While Lightning Web Components (LWC) are the modern standard for Salesforce development, thousands of organizations still rely on Visualforce pages for complex, legacy internal tools. One of the most common challenges developers face when maintaining these pages is figuring out how to pass dynamic values from the client-side (JavaScript) directly to the server-side (Apex controller). The cleanest and most reliable way to bridge this gap in Visualforce is by utilizing the <apex:actionFunction> component paired with <apex:param> tags. In plain words: An <apex:actionFunction> component automatically generates a JavaScript function on your page. When you call this function in your script, it silently triggers an asynchronous AJAX request to your Apex controller, allowing you to pass front-end variables directly into your backend code without refreshing the page.
Topic
Apex
Apex Development