title: When should I return true/false to AJAX and when should I echo "true"/"false"
body: <p>Somehow I have confused myself.</p>
  
  <p>Somehow I got it in my head that when hitting PHP with AJAX (like $.post), you had to echo back a "true" or "false" instead of returning true/false.  I see now that is not the case, but can someone break it down for me?</p>
  
  <p>Is it that there is a problem testing a boolean?  Like here</p>
  
  <pre><code>... 
  $.post('ajax/doThing',{data: data},
      function(response) {
          if(response) {
              doThis();
          }else{
              doThat();
          }
  </code></pre>
  
  <p>That is the problem case, correct?  Here I cannot return true/false, instead I must echo back a string and test the string, yes?</p>
  
  <pre><code>if(response === "true")
  </code></pre>
  
  <p>But I have seen boolean true/falses returned to ajax functions.  What is the use of this, if you cannot test a boolean on the AJAX side? And why can't ajax test a boolean?</p>
  
  <p>Or am I still confused?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Just wanted to thank everyone for their good answers on this.  I am now +2 smrter.</p>