我想加载一个外部页面(因此不使用查询移动设备中的 ajax),问题是当我使用通过单击链接标签激活的功能时,并且在此功能中我有一个 INSERT 到数据库中,链接是在脚本写入数据库之前跟随..
这是代码的一部分:
$('#aggiungiClienteRubrica').click(function() {
db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000);
db.transaction(function(tx){
var sql = 'INSERT INTO CLIENTI (nome, cognome) VALUES ("'+$('#nome').val()+'", "'+$('#cognome').val()+'")';
tx.executeSql(sql)}, errorCB);
});
在 html 文件中,我只有一个这样的标签:
<a id="aggiungiClienteRubrica" href="../client/consultClients.html" data-role="button" data-theme="b" rel="external">Add client</a>
所以问题是,我可以执行javascript,但是异步调用将插入到db中的记录没有被执行并且../client/consultClients.html页面被加载
工作完成后如何让它跟随链接?