JavaScript if condition not working
<p>I am screwed with this one the if statement is not working in javascript.
I am using js to call php and php file echo 'true';</p>

<p>My java script code</p>

<pre><code> function like_add(article_id){
$.post('my/like.php', {article_id:article_id}, function(data){
    if(data == 'true'){//this part never works
        alert(data);
    }else{
    alert(data);
    }
});
</code></pre>

<p>}</p>

<p>I tried to change alert with <code>alert('*'+data+'*');</code> </p>

<p>And got that there is a space * true*.
How can I get this script t work.</p>

<p>Whole code</p>

<pre><code> function like_add(article_id){
$.post('ajax/like.php', {article_id:article_id}, function(data){

    if(data == 'true'){
        total_votes(article_id);
    }else{
    alert(data);
    }
});
</code></pre>

<p>}
PHP code</p>

<pre><code>        if(previously_liked($article_id) === true){
        echo 'You\'ve already liked this!';                 
        }else{
            add_like($article_id);
            echo 'true';
        }


function total_votes(article_id){
$.post('ajax/total_votes.php', {article_id:article_id}, function(data){
    $('#article_'+article_id).text(data);
</code></pre>

<p>});
}</p>
