Hi everybody I need Help about SqlitePlugin cordova The error show when i charge data from json to sqlite database
Error : Uncaught # at file:///android_asset/www/plugins/io.litehelpers.cordova.sqlite/www/SQLitePlugin.js:297
JsontoSqlite.js :
var db;
var path = 'localhost/jsontosqlite/';
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
db = window.sqlitePlugin.openDatabase({name: "mydb.db"});
db.transaction(populateDB, errorCB, successCB);
}
function errorCB(err) {
console.log("error");
}
// Success error callback
function successCB() {
console.log("success");
}
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS gamme');
}
tx.executeSql('CREATE TABLE IF NOT EXISTS gamme (id integer , libelle TEXT , libelleAffiche TEXT , style TEXT , gammeParDefaut boolean , materiauId integer )');
$.getJSON(path+"gamme", function(data)
{
$.each(data, function(i,item)
{
tx.executeSql('INSERT INTO gamme VALUES (?,?,?,?,?,?)', [ item.id , item.libelle , item.libelleAffiche , item.style , item.gammeParDefaut , item.materiauID ]);
});
});
}
Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire