I'm having trouble with the following function:
function getLengthData(date, driverId) {
var length = [];
$
.get('http://xx/x/x/' + date + '/' + driverId + '')
.done(function (data) {
var test = data.length;
length.push(test);
});
return length;
}
This returns nothing while it should return an array with 1 element, the length of the data array. The next function uses the same way and works perfectly:
function getStopsFromStorage() {
var stops = [];
_2XLMobileApp.db.stopsData.load().done(function (result) {
$.each(result, function () {
stops.push(this.Id);
});
})
return stops;
}
I kinda have an idea what the problem is but no idea how to fix.
Any help would be greatly appreciated!
Thx