Hi I am calling a function get_location_tcount(1); whose declaration is like
function get_location_tcount(id,callback) {
myDB.transaction(function (transaction) {
var t_sql = 'select * from tbl_locations where location_structure_id = "' + id+ '"';
transaction.executeSql(t_sql, [], function (tx, results) {
var length = results.rows.length;
callback(length);
}, null);
});
}
This how I am calling it
var t_count = 0;
get_location_tcount(1,function(total_count){
alert(total_count); // Alerting the value
t_count = total_count; // but not setting in variable t_count
});
How to get the desired output