I'm trying to store data when the user clicks on submit button.
Here is the code:
var db = openDatabase('CBDB', '1.0', 'mySpecialDatabaseThatWontWork',10*1024*1024);
db.transaction(function (nw) {
nw.executeSql('Drop TABLE user');
});
function db1(){
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS user(empid varchar(10))');
var x = $('#nameT').val();
console.log(x);
tx.executeSql('INSERT INTO user (empid) VALUES (?)', [x]);
});
window.location.assign("www/landing.html");
}
Now, if I comment the window.location then the code works fine. But when the window is redirected to a new page the table is not created.
Any problem with the code?
Aucun commentaire:
Enregistrer un commentaire