Omar
Omar

Reputation: 8145

SyntaxError when trying to use Cordova-SQLitePlugin

I'm trying to use a prepopulated DB with PhoneGap, so I'm trying THIS plugin with the help of THIS article.. Here is the code I'm trying to run:

JS:

function onLoad() {
    document.addEventListener("deviceready", onDeviceReady, false);
}

// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
    var db = window.sqlitePlugin.openDatabase(“test.db”, “1.0”, “testsstst”, 20000);

}

HTML:

<html>
        <script type="text/javascript" src="js/index.js"></script>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Hello World</title>
    </head>
    <body onload="onLoad()">
        <div class="app">
            <h1>AAAA</h1>
        </div>
        <script type="text/javascript" src="cordova-2.2.0.js"></script>

    </body>
</html>

I get these errors:

11-10 11:19:27.961: D/CordovaLog(9264): Uncaught SyntaxError: Unexpected token ILLEGAL
11-10 11:19:27.965: D/CordovaLog(9264): file:///android_asset/www/js/index.js: Line 8 : Uncaught SyntaxError: Unexpected token ILLEGAL
11-10 11:19:27.965: E/Web Console(9264): Uncaught SyntaxError: Unexpected token ILLEGAL at file:///android_asset/www/js/index.js:8
11-10 11:19:28.976: D/CordovaLog(9264): Uncaught ReferenceError: onLoad is not defined
11-10 11:19:28.976: D/CordovaLog(9264): file:///android_asset/www/index.html: Line 27 : Uncaught ReferenceError: onLoad is not defined
11-10 11:19:28.976: E/Web Console(9264): Uncaught ReferenceError: onLoad is not defined at file:///android_asset/www/index.html:27
11-10 11:19:28.996: D/Cordova(9264): onPageFinished(file:///android_asset/www/index.html)

Any help?

Upvotes: 0

Views: 1358

Answers (1)

AndiDog
AndiDog

Reputation: 70198

Most probably your quotes:

var db = window.sqlitePlugin.openDatabase(“test.db”, “1.0”, “testsstst”, 20000);

vs.

var db = window.sqlitePlugin.openDatabase("test.db", "1.0", "testsstst", 20000);

Upvotes: 1

Related Questions