title: Why do Chrome and Firefox handle javascript variable set inside jQuery ajax() callback differently?
body: <p>Using jQuery 1.9.1, calling back to the server to check some data: </p>
  
  <pre><code>    $form = $("#form2")
      var str  = $form.serialize();
      status = true; 
      $.ajax({
             type    : 'POST',
             url     : 'check_zip.php', 
             data    : str,
             async   : false,
             success : function (data) {
               obj = JSON.parse(data); 
               var result = obj.result;
               status = result; 
             },
             error   : function (msg) {
                 alert(msg);
                 status = false;
             }
         });
  
      if (status == "false" || status === false) {
          ....
  </code></pre>
  
  <p>I found that Chrome would return status "false" (string) and Firefox would return status false (boolean).  Is this expected behavior?  I was astonished! </p>
  
  <p>The JSON being parsed is data: "{"result":false}"</p>
  
  <p>typeof(status) is string in Chrome and boolean in FF.</p>
  
  <p>The issue  seems to arise here: </p>
  
  <pre><code>         var result = obj.result;
           status = result; 
  </code></pre>
  
  <p>Because the datatype of result in Chrome is boolean, whereas the datatype of status is string.</p>
  
  <p><img src="https://i.stack.imgur.com/e3Bv7.png" alt="variable change shown in debugger"></p>