Hi there, i'm trying to get item from a local SQLITE db table:

function getInfo(itemId) {

var itemName = "defaultName";

DEMODB.transaction(
function (transaction) {
transaction.executeSql("SELECT * FROM itemsTable where id=?", [itemId], function (transaction, results) {
if (results.rows.length > 0) {
for (var i = 0; i < results.rows.length; i++) {
var row = results.rows.item(i);
var newFeature = new Object();

newFeature.getName = row['name'];

itemName = newFeature.getName;
alert(itemName);
}
}
}, null);
}
);

alert(itemName);
}

the inner alert is showing the correct content (row['name']) but the outer alert (after the loop) is showing the default VAR content. how can that be? isn't the itemName = newFeature.getName; needs to implement the "itemName" variant after the loop?

What am i doing wrong?

Thanks