What is the simplest, clearest way of seeing the output of console.log events in code. I am creating an sqlite database and want to simply alert or console.log to test if it exists or not. For example, if I do this:
function onDeviceReady() {
var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 5000);
db.transaction(populateDB, errorCB, successCB);
if(db)
{
console.log("DB created");
alert('The database is working');
}
else
{
alert('There is a problem');
}
}
I am getting no alert. Doing something wrong?
I now have this code based on this: deviceReady not working in PhoneGap application, how to?
<body onload="onDeviceReady()">
function init(){
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is ready
//
function onDeviceReady() {
var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 5000);
if(db) {
console.log('The database is working');
db.transaction(populateDB, errorCB, successCB); // only do stuff if db exists
}
else{
console.log('There is a problem');
}
}
but still no logs!