I'm using @remoteAction in my controller. My question is whether I'll be able to pass the controller variable values from the remote method to the page?
I tried using static variables in my controller but I don't get the values when the remote method is called.
Is @remoteAction method called asynchronously? But when I check the debug log, I see the remote is getting called after the constructor where I populate the varibles.
Edit :I get the list of accounts I populate in constructor. But when I call the remote method, all I get is an empty list.
function getList(callback) {
$j('#mylist').empty();
MyController.getAccountsList(function(records, e) { showList(records, callback}, {escape:true});
return true;
}
function showList(records, callback) {
console.log(records.length);
}
//remote method in controller
@RemoteAction
global static List<Account> getAccountsList() {
System.debug(MController.AccountList);
List<Account> r = MController.AccountList;
return r;
}