gpt4 book ai didi

database - 手机间隙 : INVALID_STATE_ERR: DOM Exception 11

转载 作者:搜寻专家 更新时间:2023-10-30 20:05:18 25 4
gpt4 key购买 nike

虽然我正在尝试流程一,但它失败了:

Uncaught Error: INVALID_STATE_ERR: DOM Exception 11 at file:///android_asset/www/library/custom.js:39

但是当我尝试过程二时,一切正常。

var db = window.openDatabase("Pemberton", "1.0", "Pemberton Stay App", 200000);
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
db.transaction(populateDB, errorCB, successCB);
}

过程 1:

function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS eat');
tx.executeSql('CREATE TABLE IF NOT EXISTS eat (id, image, title)');
var queries = new Array();
$.getJSON( serviceURL + 'category-list.php?cid=1&p=?', function(data) {
var results = data.items;
$.each(results,function(index,record){
if( record.id != undefined )
tx.executeSql('INSERT INTO eat (id, image, title) VALUES ("'+record.id+'","'+record.image+'","'+record.title+'")');
});

});
}

过程 2:

function populateDB(tx) 
{
tx.executeSql('INSERT INTO eat (id, image, title) VALUES (2,"one.jkd","OneFirst")');
tx.executeSql('INSERT INTO eat (id, image, title) VALUES (2, "two.png","Second")');
tx.executeSql('INSERT INTO eat (id, image, title) VALUES (3, "thr.png","Third")');
tx.executeSql('INSERT INTO eat (id, image, title) VALUES (4, "fou.png","Fourth")');
tx.executeSql('INSERT INTO eat (id, image, title) VALUES (5, "fiv.png","Fifth")');
}

最佳答案

我使用了 .ajax() 并通过添加 async:false 解决了这个问题;

$.ajax({ type: "POST", url: myurl, dataType: "xml", async : false, success: function (xml) {

                    $(xml).find('articles').each(
function ()
{

tx.executeSql('INSERT INTO ORDERS (id, client_ID, status) VALUES ('+ idord2 +', 4, "done" )');
});
}
});

关于database - 手机间隙 : INVALID_STATE_ERR: DOM Exception 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12265003/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com