Is there a way to pass an unknown number of parameters to Visualforce JavaScript Remoting like:
remoting('getExampleData', arg1, arg2, arg3)
function remoting(target, ...args) {
Visualforce.remoting.Manager.invokeAction(
configSettings.remoteActions[target],
args,
function (result, event) {
if (event.status)
console.log(result);
},
{ escape: false }
);
}
Thanks!
You can't pass unknown number of parameters to Visualforce JavaScript Remoting, but you can use wrapper-object like a parameter and this object can contains all your required data. See this example for more details.
Also you can manually serialize all your required parameters to single string and pass it as one parameter, and then deserialize it on server side.