Sorry for a simple question. I'm totally new to Salesforce.
I want to pass JavaScript array to Apex to save its data in the Salesforce custom object. I want to know the best approach to do it without JavaScript remoting. Following is the JavaScript code.
$("#saveCalendar").click(function () {
getDatesBackup = document.getElementById('selectedDates').options;
for(var k=0; k<getDatesBackup.length; k++){
allSelectedDates.push(getDatesBackup[k].text);
console.log("Dates Backup : "+getDatesBackup[k].text);
}
console.log(allSelectedDates);
});
Best Answer
You can use ActionFunction for this. Here is sample for your reference.
Controller:
VF Page:
Note that we are calling
IWantToDebug
Action from JS usingparaFunction
Action Function.