I am using phonegap and sqlite to develop cross-platform mobile app for android,ios,blackberry.For reference i am using http://docs.phonegap.com/en/1.0.0/phonegap_storage_storage.md.html. My index.html is below
1.i have got phonegap.jar in lib
2.got phonegap.js in assests/wwww
3.got sqlite browser and sql shell downloaded in my hardisk
4.got jquery.min.js
I would like to know how to give the location of my sqlite from index.html so that it can make a connection with it. If I just pass in phonegap.js it is not making connection to sqlite.
<head>
<title>Contact Example</title>
<script type="text/javascript" charset="utf-8" src="js/phonegap-1.4.0.js"> </script>
<script type="text/javascript" src="js/jquery.min.js"/></script>
<script type="text/javascript" src="js/jquery.mobile-1.0rc2.min.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad(){
document.addEventListener("deviceready", onDeviceReady, true);
var db = window.openDatabase("Dummy_DB", "3.0", "Just a Dummy DB",200000);
alert("db="+db); //not printing
}
function onDeviceReady(){
navigator.notification.alert("doo");//only printing this
}
<body onload="c()">
<h1>n Example</h1>
<p>Database</p>
</body>
There are couple of possible problems:
openDatabasethe document has loaded, but phonegaphas not. The problem is that you call the method
c()onBodyLoadnot
onDeviceReadyas advised in the phonegap tutorial. Seehere.
to check is to add the eventListener for deviceready. If it gets
fired the javascript is loaded ok.