我想"阅读"来自webSQL客户端数据库,但警报不会丢弃任何数据。这是代码:
var db = openDatabase('mydb', '1.0', 'text', 2*1024*1024, callback());
var interval;
function callback(){
interval = setInterval(callback1.bind(this), 1000);
}
function callback1(){
if(db != 'undefined'){
clearInterval(interval);
db.transaction(function(tx){
tx.executeSql('create table if not exists jj(id unique, text)');
tx.executeSql('insert into jj values(1, "kata")');
//It's here! <----------------------------------------------
tx.executeSql('select * from jj', [], function(tx, results){
alert(results.rows.item(0).text);
});
});
} else {
alert('error');
}
}
我在哪里犯错?