jQuery Ajax Callback comparison not working
<p>I have an ajax call that posts info to a PHP page. The page will respond OK if all is fine. The jQuery script should check if the response is OK and only then keep running the script. This is what I have:</p>

<pre><code>    $("#button").click(function(e) {
    $.post('ajax.php', {status: $(this).val()}, 
    function(data) {
        if (data == "OK") {
            alert ("All good");
        } else {
            alert ("Sorry, status could not be changed. Server answer: "+data);
        }
    });
    e.preventDefault();
});
</code></pre>

<p>However, the comparison (data == "OK") <em>always</em> fails. Even though the script returns "OK". I get this response:</p>

<p><code>Sorry, status could not be changed. Server answer: OK</code>. So as you can see it returns "OK". There is no space or anything else that can be the cause. It's driving me crazy! What can it be?</p>

<hr>

<p>Edit: solved by debugging the OK. There turned out to be an ENTER after the string. </p>
