How to call method in Apex With @RemoteAction
1. @RemoteAction : use to call method from page to class by js
In Apex class:
In Apex class:
@RemoteActionIn JS method:
global static List<Account> getAccounts() { //your code }
function getAllAccount(){
// call method from saleforce class
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.OfficeLocatorController.getAccounts}',
function(responseAccounts, event){
initialize(responseAccounts)
},{escape: true}
);
}
Comments
Post a Comment