The title is little bit confusing because I am not sure how to explain it. So there is the code:
let label = getLabels(min, max)
console.log(label)
and getLabels:
function getLabels(minId, maxId){
    $.ajax({
        method: 'post',
        url: 'ajaxs/get-attribute-value-name',
        data: {
            min: minId,
            max: maxId
        },
        success: function (data) {
            return {
                min: data.min,
                max: data.max
            }
        }
    })
}
What I get in the console is undefined. What is the proper way to assign obejct to label variable? Is it good practice at all? Both data.min and data,max return what is expected. Thank you!
