I am calling a function db.transaction with following code:
db.transaction(createSheetDB, function(){alert("Sheet creation error!")}, function(){alert("Sheet created!")});
The function createSheetDB is a callback function which is implicitly called by db.transaction() which also passes it a parameter tx. I have implemented function createSheetDB(tx) like this:
function createSheetDB(tx) {
var nextId = getNextId();
tx.executeSql("INSERT INTO SHEET(id, name, desc) VALUES("+nextId+",'"+sheetName+"','"+desc+"')", [],
function(){alert("Sheet row inserted!")},
function(tx, err){alert("Sheet row insertion Error: "+err.message+" "+err.code)}
);}
Now the problem is the values of sheetName and desc are available only in the calling function. How do I pass them onto function createSheetDB(tx)?