I'm working on a PhoneGap app and I have this piece of code in a loop
htmlR += "html code here";
tx.executeSql('SELECT Question,Grp from KnowSelf where Dimension = "'+result.Dimension+'"', [], function(tx,resultR){
var leng = resultR.rows.length;
for(var i = 0; i < leng; i++){
var resultsR = resultR.rows.item(i);
htmlR += '<li class="catsli">'+resultsR.Question+'</li>';
htmlR += '<li class="line"><img class="line" src="iPhone3/Line.png" alt="line"/></li>';
}
},errorCB);
htmlR += "continue html code here";
My problem is, inside the tx.executeSql(.... htmlR += li tags
is not adding to the outer htmlR.
executeSqlis a closure over it and I don't see it being shadowed anywhere. Are you sure the callback accepted byexecuteSqlhappens synchronously? Sounds like it may be async, hence your not seeing the results immediately.