Gianluca Molinaro
Posts: 0
Joined: Sat May 03, 2014 2:21 pm

how to use PhoneGap inside Javascript

Hi,

i try to use PhoneGap in a Javascript file.
From Create new JavaScritp i create a file and put this code:

function openDB() {
var db = window.openDatabase("TestDB", "1.0", "TestDB", 1024 * 1000);
db.transaction(initDB, errorCB, successCB);
}

function initDB(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS Settings (_key TEXT, value TEXT )');
tx.executeSql('INSERT INTO Settings (key, value) VALUES ("Key1", "Value1")');
tx.executeSql('INSERT INTO Settings (key, _value) VALUES ("Key2", "Value2")');
}

// Transaction error callback
function errorCB(tx, err) {
alert("Error processing SQL: " + err);
}

// Transaction success callback
function successCB() {
alert("success!");
}

but does'n work: error openDatabase is undefined function

Any Help?
Tnk

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

how to use PhoneGap inside Javascript

Hello,

Are you testing it on the device? PhoneGap will work only on device.

Gianluca Molinaro
Posts: 0
Joined: Sat May 03, 2014 2:21 pm

how to use PhoneGap inside Javascript

Hi,

i try only on test mode.
Now i try it on my device.

Tnk a lot

Return to “Issues”