i am testing Phonegap Web Storage for a small project:
var listsCount = 0;
tx.executeSql("SELECT * FROM list WHERE id = ?", [id], successGetList, errorGetList );
function successGetList(tx, results){
listsCount = results.rows.length; // this will be 2, in my case
}
function errorGetList(err){
console.log("Error processing SQL: "+err.code);
}
console.log(listsCount); // this will show 0, instead of 2
the issue i'm having is that listsCount
doesn't get set inside the successGetList
method. Even if i return it there.
any ideas on how can i set that variable inside of successGetList
function ?
thanks