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;
}
Main.js
queryDB(processResult, function(arr) {
$.each(arr, function(i, elem) {
});
});
In above Code item_Codes is array.Here i need to print the Array after the data is loaded.But when i try to print the array it displays null. How Can i print the Array after the data is loaded to the Array.