How can I return value from bellow inner anonymous function.
function getDayFromCalendar() {
var db = openDatabase('Calendar', '1.0', 'myapp', 2 * 1024 * 1024);
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM calendar LIMIT 1', [], function (tx, results) {
return results.rows.item(0).date;
});
});
}
function getDayFromCalendar() {
var db = openDatabase('Calendar', '1.0', 'myapp', 2 * 1024 * 1024);
var outerResult = db.transaction(function (tx) {
var innerResult = tx.executeSql('SELECT * FROM calendar LIMIT 1', [], function (tx, results) {
return results.rows.item(0).date;
});
// here you have inner function result
return innerResult;
});
// here you have outer function result
alert(outerResult);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.