You need to sign in to do that
Don't have an account?

How to pass values form Actionfunction to Controller in salesforce
V.f page:
Controller:
need to pass the javascript varible to the Apex method in salesforce..
Thanks D
Deepika
<apex:page controller="Passingvaluestocntroller"> <apex:form > <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#click").click(function(){ debugger; alert("hello"); var name ="Deepika"; alert(name); var branch="Salesforce"; alert(branch); debugger; var test = {"Empname":name,"Empbranch":branch}; alert(test); method1(); }); }); </script> <apex:actionFunction name="method1" action="{!method1()}"/> <input type="button" value="test" id="click"/> </apex:form> </apex:page>
Controller:
public class Passingvaluestocntroller { public void method1(string name, string branch){ system.debug('salesforce testing'); system.debug(name); system.debug(branch); } }
need to pass the javascript varible to the Apex method in salesforce..
Thanks D
Deepika
I hope you are doing well .....!!
First of all copy below code in your Org.
I have create Visualforce page and class review it and change accroding to your requirement.
Visualforce page : Apex Class : Note : Make sure in apex:actionfunction there is reRender="abc" (Write as it is)
Hope this helps you.
Let me know your review.
If this helps kindly mark it as solved so that it may help others in the future.
Thanks & Regards,
Foram Rana
All Answers
I hope you are doing well .....!!
First of all copy below code in your Org.
I have create Visualforce page and class review it and change accroding to your requirement.
Visualforce page : Apex Class : Note : Make sure in apex:actionfunction there is reRender="abc" (Write as it is)
Hope this helps you.
Let me know your review.
If this helps kindly mark it as solved so that it may help others in the future.
Thanks & Regards,
Foram Rana