index.js
var processResult = function (items) {
return items;
};
function queryDB(callback) {
var sqlTxt = "SELECT * FROM DEMO";
db.transaction(
function (tx) {
tx.executeSql(sqlTxt, [],
function (tx, results) {
var item_Codes = [];
for (var i = 0; i < results.rows.length; i++) {
item_Codes.push({
item_code: results.rows.item(i).itemCode
});
}
callback(item_Codes);
}), errorCB;
});
return false;
}
保存.js
queryDB(processResult, function (arr) {
$.each(arr, function (i, elem) {
});
});
我使用上面的代码从内部存储中检索数据并填充到数组中运行良好。但是给出以下错误 11-14 11:34:03.929: E/Web Console(8538): Uncaught TypeError: undefined is not a function: 67