title: use $.ajax() response for if else statement
body: <p>I just can't get it to work that I'm using the response of an ajax call in an if/else statement. If I output the response in console.log() it shows that it is correctly set, but the simple if/else statement just doesn't work.</p>
  
  <pre><code>function check_foo() {
  dataString = {action: 'do_this'};
  
  $.ajax({
      type: "POST",
      url: "ajax.php",
      data: dataString,
      success: function(foo) {
          console.log('foo='+foo); // output: foo=ok
  
          if (foo=="ok") { // should be true, but isn't
             console.log('foo='+foo+' -&gt; OK');
          } else { // instead this gets output
             console.log('foo='+foo+' -&gt; FAIL'); // output: foo=﻿ok -&gt; FAIL
          }
      }
  });
  }
  
  check_foo();
  </code></pre>
  
  <p>ajax.php:</p>
  
  <pre><code>echo 'ok'; // This is the result of the call
  </code></pre>
  
  <p>so foo is correctly set as 'ok' (as shown in console.log), but the if/else doesn't seem to recognize it...</p>
  
  <p>Any help would be very much appreciated!</p>