I need to return my behaviors but its not working
function getBehaviorList() {
var behaviors = getBehaviors();
console.log("Making behavior list");
console.log(behaviors);
$.each(behaviors, function (index, value) {
if (value.indexOf("User/.lastUploadedChoregrapheBehavior") < 0) {
$('#installedBehaviors tr:last').after('<tr><td>' + value.split('/').pop() + '</td><td><a href="#" class="btn btn-default" id="' + value + '"><span class="text-color-green glyphicon glyphicon-play-circle"></span> Start</a></td></tr>');
}
});
$("#installedBehaviors a").click(function () {
startBehavior(this);
});
}
function getBehaviors() {
console.log("Getting behaviors");
session.service("ALBehaviorManager").done(function (behaviorManager) {
behaviorManager.getUserBehaviorNames().done(function (behaviors) {
behaviors;
console.log(behaviors);
return behaviors;
});
}).fail(function (error) {
console.log("An error occurred: ", error);
});
}
this is the error i get in the console
Getting behaviors
Making behavior list
undefined
Uncaught TypeError: Cannot read property 'length' of undefined
["User/.lastUploadedChoregrapheBehavior/test","User/actura-test/test", "User/check-update", "User/follow-me"]
dose anyone got an idea why?