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
smita bhargavasmita bhargava 

remoting in salesforce

Can any one please explain how remotng in salesforce works?
In what specific scenarios it is used and its advantages.

For ex: if I have json data and I need to display 1 lakh records in visual force page does remoting help?

I see the techncial jargon in all posts but its not very clear to me.

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Smita,

1. What is the use Javascript Remoting?
 A) You can communicate with VF page's controller's methods without posting your form. Action Function posts the data.
2. If more flexible, When we need to use?
A) JS remoting is not an alternate for Action function. There may arise a case in a requirement to get/set some information or basically to perform an from the controller without actually posting the form.
3. What is the use of Action function?
A) It posts data to the controller. Unlike JS remoting you can rerender certain portions of your VF page. Because of this particular page rendering, you can get refreshed values from the server.
4. What is the difference between Action function and Javascript remoting?
i) Action function posts the form and JS Remoting does not
ii) Action function can do partial page rerendering which JS remoting can not.
5. JS remoting used for mainly calling the APEX method from javascript? if yes whats the benefits ? can u please let me know real time scenario?
i) Auto-complete search. for e.g. to list the articles titles while ii
) Any scenario where you dont want to refresh the page/no partial page rendering and just want to perform an action.
iii) Any scenario where you need to repetitively call controller without a need to rerender.
iv) There is a possibility to avoid View-State issue when you use JS remoting because you will just give back the data to the user but not keep it on the server which mounts to View-State.

Please refer the below link for reference. Hope it helps.

Please mark it as best answer if the information is informative.

Rahul Kumar
smita bhargavasmita bhargava
Hi Rahul

thanks for indepth explanation.
I have a query.
I have an apex controller1 with some methods defined in it.
This class is being referenced in the visualforce page and I am using an actionfunction for some operation.

Now I write apex controller2 which may be referenced in apexcontroller1 or may not be.
so if I use actionfunction to call apexcontroller2 method will it work?

for the above scenario what abt javascript remoting?

smita B