javascript - how to pass arguments to PhoneGap database transaction executeSql functions -


i'm new phonegap i'm using database , working fine below code

db = window.opendatabase("sample", "1.0", "phonegap demo", 200000);     db.transaction(getdetails, transaction_error);  function transaction_error(tx, error) {     $('#busy').hide();     alert("database error: " + error); }  function getuserdetails(tx) { var sql = "select id, name,  displayname details name=name";     try {         tx.executesql(sql, [],getlist_success);     }     catch(err)     {         alert(err);     } }  function getlist_success(tx, results) {     var len = results.rows.length;     for(var i=0; <len; i++)     {         //some code goes here         }     db = null; } 

now want use functions getuserdetails , getlist_success passing paramenters, tried below code giving error

db = window.opendatabase("sample", "1.0", "phonegap demo", 200000);     getuserdetails(db);   function getuserdetails(tx) { var sql = "select id, name,  displayname details name=name";     try {         tx.executesql(sql, [],getlist_success);     }     catch(err)     {         alert(err);     } } 

the error typeerror:'undefined' not function in catch block, can 1 me through this?. in advance

the executesql function need 4 parameters, try this:

function errorcallback(err){ //show error } ... tx.executesql(sql, [],getlist_success,errorcallback); 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -