Comparing two identical strings in JQuery returns false
<p>I discovered an interesting problem with an echoed value from an AJAX request of JQuery, which I don't have an answere for: </p>

<p>My <code>data == "LOCKED"</code> never returns true (line 13)!</p>

<p><strong>JQuery</strong> -> AJAX call on button-click:</p>

<pre><code>$.ajax({
        url: "ajax/login_ajax_call.php",
        method: "POST",
        data: { user: usr, password: pwd }
    }).done(function(data){
            if(data == true || data == "true"){          // -&gt; this works with data beeing true (bool) or "true" (string)
                $("#form_submit").submit();
            }
            else{
                console.log(jQuery.type(data));          // -&gt; (string)
                console.log(data);                       // -&gt; "LOCKED" 
                console.log(jQuery.type("LOCKED"));      // -&gt; (string)
                if(data == "LOCKED"){                    // also tried "===" but it never returns true
                    [...]            
                }
                else{
                    [...]
                }
            }
    }); 
});             
</code></pre>

<p><strong>PHP</strong>(1) -> gets a value returned by a Class(PHP(2)): </p>

<pre><code>include_once("../Classes/Login_check.php");
$lih = new Login_check();
$result = $lih -&gt; check($_POST["user"], $_POST["password"]);
var_dump($result);                                     // -&gt; string(6) "LOCKED"
echo $result;
</code></pre>

<p><strong>PHP</strong>(2, "Login_check.php"):</p>

<pre><code>[...]
// also tried: 
// $test = "LOCKED"; 
// var_dump($test);                                    // -&gt; string(6) "LOCKED"
// return $test;
return "LOCKED";
[...]
</code></pre>

<p>Tell me if you need further informations!
I hope anyone know what causes this problem!</p>