I have some problem with variables. I wrote this function and it doesn't work. Why? mydata = null. How get data from post function?
function getData(input) {
    var mydata = null;        
    $.post('getdata.php', {
            input: input
        },
        function(data) {  
            mydata = data;
        }, 'json'
    );   
    return mydata; 
}
 
    