I'm writing Telerik platform hybrid app. I want to write a function which returns a number from Everlive cloud. Here's my code.
function getSector(){
var result = 0;
var data = el.data('csector');
data.get()
.then(function (data) {
var obj = JSON.parse(JSON.stringify(data));
//alert(obj.result[0].current);
result = obj.result[0].current;
},
function (error) {
alert(JSON.stringify(error));
});
return result;}
Problem is that I can't return value. It always returns 0. Seems like result can't be changed from nested function? Alert works great. Please help. Documentation