I want to make a function that return a value of sql result set list (dataLite).the problem is, I can't even read the value of variable(dataLite) outside db.transaction
, it will return null
value . I am new to javascript and Jquery so I hope I can find an answer here. Here's part of my function
function functionA(){
var dataLite=null;
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM tableA', [], function (tx, results) {
var len = results.rows.length, i;
msg = "<p>Found rows: " + len + "</p>";
alert(msg);
dataLite=results.rows;
}, null);
});
alert(dataLite+'>>>');
return dataLite;
}