我做了一个从 db 中选择数据并显示警报的函数,但在 Success 函数中出现以下错误:
无法读取未定义的检索数据的属性“行”
这是我的功能
function selectAll(){
DB.transaction(
function(transaction) {
transaction.executeSql("SELECT * FROM CDprodutos", [], retrieveData()); //The retrieveData function is where the data is sent/returned to in parameters (transation, results)
});
}
function retrieveData(transaction, results) {
for(var i = 0; i < results.rows.length; i++) {
var data = results.rows.item(i)['id']
alert(data.value);
}
}