var action = cmp.get("c.ApexControllerMethod");
action.setParams({
"param1" : cmp.get("v.param1"),
"param2" : cmp.get("v.param2"),
"param3" : cmp.get("v.param3"),
"param4" : cmp.get("v.param4")
});
action.setCallback(this, function(response){
var state = response.getState();
if(state === "SUCCESS"){
var returned = response.getReturnValue();
//Do whatever you need to do
}
else if(state === "INCOMPLETE"){
console.log('No response from server or client is offline.');
}
else if(state === "ERROR"){
var errors = response.getError();
if(errors){
if(errors[0] && errors[0].message){
console.log('Error: ' + errors[0].message);
}
} else {
console.log('Unknown error');
}
}
});
$A.enqueueAction(action);