function outDb(outData) {
var temp;
var db = window.sqlitePlugin.openDatabase({ name: "test" });
db.executeSql("SELECT " + outData + " FROM test", [], function (res) {
switch (outData) {
case "goal": temp = res.rows.item(0).GOAL;
break;
case "curDate": temp = res.rows.item(0).CURDATE;
break;
case "Day1": temp = res.rows.item(0).DAY1;
break;
case "Day2": temp = res.rows.item(0).DAY2;
break;
case "Day3": temp = res.rows.item(0).DAY3;
break;
default: temp = "is default";
}
});
return temp;
}
I want to save data into myData;
var myData = outDb("goal");
but it is not working. because return faster than variable save.
What can I do?
Aucun commentaire:
Enregistrer un commentaire