I want to return data that comes from a sqlite query in javascript. The problem is as follows:
App.dbInstantion.transaction(function(tx){
tx.executeSql('SELECT * FROM footsteps', [],
function(tx, results) {
for (var i = 0; i < results.rows.length; i++) {
footsteps.push(results.rows.item(i));
}
//WRONG RETURN SCOPE
return footsteps;
}, self.errorCB
);
}, self.errorCB);
//FOOTSTEPS IS NOT FILLED YET SO AN EMPTY ARRAY IS RETURNED
return footsteps;
I tried to use $.Deferred
but that did not solve the problem. Does anyone have a suggestion for this?
Greetz,