Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Namespaces and JavaScript Remoting
1Visualforce.remoting.Manager.invokeAction(
2 'fully_qualified_remote_action',
3 invocation_parameters
4);The fully qualified remote action is a string that represents the complete path to the remote action method, including namespace, base class, and so on: namespace[.BaseClass][.ContainingClass].ConcreteClass.Method. Use $RemoteAction in an expression to automatically resolve the namespace, for example {!$RemoteAction.MyController.getAccount}.
- The parameters to send to the @RemoteAction method, if any.
- The callback function, which handles the returned result.
- Configuration details for the invocation, if any.
1<script type="text/javascript">
2function getRemoteAccount() {
3 var accountName = document.getElementById('acctSearch').value;
4
5 Visualforce.remoting.Manager.invokeAction(
6 '{!$RemoteAction.MyController.getAccount}',
7 accountName,
8 function(result, event){
9 if (event.status) {
10 document.getElementById('acctId').innerHTML = result.Id
11 document.getElementById('acctName').innerHTML = result.Name;
12 } else if (event.type === 'exception') {
13 document.getElementById("responseErrors").innerHTML = event.message;
14 } else {
15 document.getElementById("responseErrors").innerHTML = event.message;
16 }
17 },
18 {escape: true}
19 );
20}
21</script>