I have two command buttons cancel, canceAll. I have two methods cancel, cancelAll in conteoller. How can i call actionfunctions from single javascript function based on the button clicked? I tried like this but it is not saving, showing compilation error.
function cancelAllFunc(Clicked_Id){
var id = Clicked_Id.id;
if (confirm("--?") == true) {
if(id='1') {
cancelAllMethod();
}
else {
cancelMethod();
}
} else {
}
}
<apex:commandButton value="Cancel All" onclick="cancelAllFunc()" id="1"/>
<apex:commandButton value="Cancel" onclick="cancelAllFunc()" id="2"/>
<apex:actionFunction name="cancelAllMethod" action="{!cancelAllMethod}" />
<apex:actionFunction name="cancelMethod" action="{!cancelMethod}" />