I have the following code (simplified):
function blub () {
db.transaction(function (tx) {
tx.executeSql("SELECT * FROM table", [], function (tx, rs) {
for(var i = 0; i < rs.rows.length; i++) {
insert_list_element_into_html_list();
}
updateList();
});
}, myMSG("error"), myMSG("success"));
}
function updateList() {
$('ul').listview('refresh');
$('ul').trigger('create');
}
function myMSG (msg) {
return function (txt) {alert("MSG: "+msg+" "+txt.code)};
}
Now this function does alert "error", but when I comment updateList() it does alert success.
How is this possible? I thought that the transaction finishes independent of what the callback function contains, and the SELECT query should easily succeed.
Aucun commentaire:
Enregistrer un commentaire