I am not able to retrieve the value of the countEventChecks variable after success. How can I assign the value of a return to another variable?
for (var x = 0; x < eventosCkeckedPeloUser.length; x++) {
if (eventosResponse[i].id == eventosCkeckedPeloUser[x].id) {
confirmCheck = true;
evento = {
"id": eventosResponse[i].id,
"img": eventosResponse[i].get("eve_imagem"),
"checks": countChecks(eventosResponse[i]),
"userCheck": confirmCheck
}
$scope.eventos.push(evento);
}
}
function countChecks(evento) {
var relation = evento.relation("eve_users");
var query = relation.query();
query.count({
success: function (res) {
return res;
}
});
}