I have made a json call from this type of function and i got the result, But i cannot return this value to another function
get_target_amount(full)
this is my function. after console.log(get_target_amount(full))
result is undefined. what is the reason for this?
function get_target_amount(full) {
var target = '';
var param = {};
param.sub_category_id = full["sub_category_id"];
param.project_month = full["project_month"];
jQuery.post(site_url + '/Progress_project_create/get_target_amount', param, function (response) {
if (response !== null) {
target = response.target_amount;
} else {
target = 'Target amount not found';
}
return target;
}, 'json');
}