why when i try to return value from function i get undefined? i know i use void function but what happen if i want get value form function like that?
thanks!
 var t = getdata();
 console.dir("test:" + t); -- > undefined
 function getdata() {
            var list = "";
            $.ajax("api/publish",
                { method: "get" })
                .then(function (response) {
                    console.dir(response); --> print the response 
                });
            return list;
        }
 
     
    