I have this simple JS function implementation within my VF page:
<script>
function toSend(){
var myField;
//Received myField value with some code//
callingActionFunction(myField);
//some more coding//
}
</script>
<apex:actionFunction name="callingActionFunction" action="{!getFieldID}" immediate="true" rendered="false">
<apex:param assignTo="{!agentObjID}" name="myField" value="myField"/>
</apex:actionFunction>
My controller class:
public String agentObjID {get; set;}
public void getFieldID(){
//SOQL to query based on the value: agentObjID
//but I am not receiving anything from my VF page.
}
But this above implementation is not seeming to work. All I am trying to do is: get the myField
value in the VF's JS function and pass it to my controller class (I have get/set variable) and retrieve some record(s) based on that value. Can someone suggest me if I am doing it wrong or missing something simple or, my approach itself is invalid?