Return not working fine

Return not working fine

Hey there,

I'm trying to make a function which calls a php script and then get the users password and return it.
I use post for this. When i use return inside post or outside but i declared a variable inside post it doesnt work either. But if i return the username it works fine. This is my code

--- JAVASCRIPT ---
function getpass(username)
{
      $.post("getpass.php", {Username: username}, function(response)
      {
            return response; // the php script works fine, i tested it.
      });
}

function displaypass()
{
      if(getpass("admin") == PasswordInput)
      {
            alert("Password is correct");
      }
      else
      {
            alert("Wrong, the pass is " + getpass("admin"));
      }
      // This alert getpass(admin) doesnt work, it only shows me Wrong, the pass is 
}