How to make variable inside this post, Global? the console.log(BANK_NAME) returns values when its inside this POST function but outside that it says undefined? can anybody help me how to solve this?
var param={'id':$('#bankId').val()};
BANK_NAME;
$.post('<?php echo base_url(); ?>Employees/loadBankDataByID',param,function(data){
// console.log(data);
var obj=JSON.parse(data);
obj=obj[0];
var BANK_NAME = obj.BANK_NAME;
console.log(BANK_NAME); // it returns that value.
});
console.log(BANK_NAME); // it say undefined here/