Here I am explaining Get Field Values From Visualforce Page To Apex Class Controller. Below is the sample code snippet, I have created one controller class and one visual force page associated with it.
Visual force page has to Submit button.
Once a user clicks on the button, I am sending email using apex code.
OR
You can Go to the URL and type (Change the salesforceinstancename with your salesforce org URL).
Go to : https://salesforceinstancename/apex/passparamFromVFtoController.
JavaScript Remoting is a framework or tool that front end developers can use to make an AJAX request from a Visual force page directly to an Apex controller. JavaScript remoting allows you to run asynchronous action by separating the page from the controller and to perform tasks on the page without having reloading the entire page.
JavaScript Remoting is the well-organized and competent way of calling the controller in an asynchronous manner and passing data in from the page, because you are sure that you are passing only that data which you need each time that you make a call.
Step 1: Create an Apex controller called AccountRemoterClass
global with sharing class AccountRemoterClass {
public String accountName { get; set; }
Visualforce.remoting.Manager.invokeAction(
<input id="accountSearch" type="text"/>
<apex:pageBlock id="block">
Below are the JavaScript Remoting Limits:
If your request requires more time to complete the transaction, then configure a longer timeout. You can setup it to 120 seconds.
Most of the interviewer asks the question, what is the maximum response size of your remote call ?
Answer is : maximum 15 MB.