Returned variable is 'undefined' through javascript function
I am having a little bit of trouble...
I am trying to get a lookup result as part of a web app, but struck-upon a little trouble.

I have a function that runs of a button click:


    $(function() {
    	$('#bnt_fund_8y').click(function() {
    		console.log(dbCheck("study_mode"));
	}
    });
This dbCheck function goes away and check the local DB to see what study_mode is set, in the below function:

    dbCheck = function(dbSearch) {
    	mydb.transaction(
    		function(transaction) {
    			transaction.executeSql('SELECT "'+dbSearch+'" FROM funding WHERE id = 1',[], function(transaction, results) {
    				var dbResult = results.rows.item(0).study_mode;
    				alert(dbResult);
    				return(dbResult);
    			}, errorHandler);
    		});
    	}

The alert display the correct variable, but he console log displays undefined.
any help on this welcome...
Returned variable is 'undefined' through javascript function
===

I am having a little bit of trouble...
I am trying to get a lookup result as part of a web app, but struck-upon a little trouble.

I have a function that runs of a button click:


    $(function() {
    	$('#bnt_fund_8y').click(function() {
    		console.log(dbCheck("study_mode"));
	}
    });
This dbCheck function goes away and check the local DB to see what study_mode is set, in the below function:

    dbCheck = function(dbSearch) {
    	mydb.transaction(
    		function(transaction) {
    			transaction.executeSql('SELECT "'+dbSearch+'" FROM funding WHERE id = 1',[], function(transaction, results) {
    				var dbResult = results.rows.item(0).study_mode;
    				alert(dbResult);
    				return(dbResult);
    			}, errorHandler);
    		});
    	}

The alert display the correct variable, but he console log displays undefined.
any help on this welcome...