Q:

alert(message) returns an empty string

SOLVED by @Hanky 웃 Panky!
I am implementing a login function.
The javascript part:
function login() {
    var n = $('#userl').val();
    var p = $('#passl').val();
    if ( n != "" && p != ""){
        $.post("functions.php",{userl: n, passl: p}).done(function(mesaj){
            if(mesaj  == "")
               alert("!!!!!!!!!!EMPTY STRING!!!!!");
            else
            alert(mesaj);
        });
    }
    else {
        alert("Enter name and/or passwort");
    }
};

And the function from function.php looks:
function login($nume,$parola)
{
    $sql = "SELECT id FROM `Users` WHERE nume ='".$nume."' ANY password = '".md5($parola)."'";
    $q = mysql_query($sql);
    if(!$q)
        die(json_encode(array("mesaj" => "Invalid")));
    else{
        $x = mysql_fetch_array($q);
        if (empty($x))
            die(json_encode(array('mesaj' => 'The user does not exist')));
        else {
        //    $user = new User($x['id']);
            session_start();
            $_SESSION['user_id'] = $x['id'];
            $_SESSION['loggedin'] = "yes";
            die(json_encode(array("mesaj"=>"you were logged")));
        }

        }
    //this part may be useless
    die(json_encode(array("mesaj"=>"you were not logged")));
}

if (isset($_POST['nume']) AND isset($_POST['parola']))
         login($_POST['nume'], $_POST['parola']);

The problem is it keeps alerting the EMPTY STRING and I think it doesn'n even acccess my login function from php...so the message comes back the way it went: empty

A:

  $.post("functions.php",{userl: n, passl: p})

Compare that with
if (isset($_POST['nume']) AND isset($_POST['parola']))

And spot your error :)
You are sending user1 and pass1 and in PHP you are checking for nume and parola which don't exist obviously.

