--Controller--
Public class MyController {
Public string MyString_From_Methode{get;set;}
public MyController(ApexPages.StandardController controller) {
}
public string ActionFunMethode(){
MyString_From_Methode = 'Method called from js using Action function';
return null;
}
}
-------------------------------------
Lets debug this for understanding:
In the above statement "actionFunName" is the name given to this action function statement and you should use this name while calling AF in js as you can see in js function below:
function javaScrpt(){
actionFunName(); //Line 2
}
Line 2 call our action function statement it does not call controller method from here, your controller method will be called from AF statement using attribute action="{!ActionFunMethode}"
ActionFunMethode is the method in your controller class.
Public string ActionFunMethode(){
MyString_From_Methode = 'Method called from js using Action function';
return null;
}
This method puts a value for a variable "MyString_From_Methode" which is then displayed in vf page.
Action function reRenders the outputtext attribute in vf page which displays this variable (that is page is refreshed and now the new value set in method is displayed).
-- Visualforce page--