嗨,我正在调用一个函数 get_location_tcount(1);其声明就像
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);
});
}
我怎么称呼它
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
});
我正在使用 t_count
shelfs_list += '<p>Total Count : ' + t_count + '</p>';
我是在调用函数后才设置的