我定义了以下 Javascript 函数:
function RecoverDataFromTable(table_name) {
query = "";
//some code that build a query string from table_name and
//other arguments given to the function
function Query(database) {
database.executeSql(query, [], RecoverResults, Error)
}
function RecoverResults(database, results) {
var my_result = results.rows(0).id;
// assume this works and store a value to my_result
}
function Error(error) {
//alert something
}
function Success() {
//alert something
}
database.transaction(Query, Error, Success)
}
现在,我怎样才能返回 my_result 值以便我可以做到这一点?
var my_var = RecoverDataFromTable(table_name, argument1, argument2.....)
提前致谢。询问您是否需要更多解释。:)
http://www.raymondcamden.com/index.cfm/2012/1/6/Working-with-dates-and-SQLite-in-PhoneGap