如果web sql中的事务成功,如何显示成功警报?

时间:2016-03-24 05:45:30

标签: javascript jquery html5

var brand = "Blare";
var price = "2000$";
var color = "black";
var success = tx.executeSql("INSERT INTO car (brand, price, color) VALUES ('"+brand+"','"+price+"','"+color+"' ")");

if(success) {
    alert("successfully added");
}

如果web sql中的事务成功,如何显示成功警报?

1 个答案:

答案 0 :(得分:0)

真的很简单。请检查此链接github

db.transaction(
    function(tx){
        tx.executeSql( "INSERT INTO car(rules) VALUES(?)",
        ['You do not talk about Fight Club'],
        onSuccessExecuteSql)
    }
)

function onSuccessExecuteSql( tx, results ){
    console.log( 'Execute SQL completed' )
}