title: JQuery to PHP with JSON
body: <p>The JQuery gets the data and send it to the PHP like this:</p>
  
  <pre><code>$(document).ready(function(){
  
          var email = encodeURIComponent($('#email').val());   
          var act = encodeURIComponent($('#act').val());   
          $('#loadingB').fadeIn(); 
          $.ajax({ 
              type: 'POST', url: 'activate.php',  dataType: "json",  data: { email: email, act: act,  }, 
              success: function(result) {                 
                  if (!result.success) { timeout = setTimeout(function(){ $('#loadingB').fadeOut(); }, 1500); $('#fail').fadeIn(); }  
                  else { timeout = setTimeout(function(){ $('#loadingB').fadeOut(); }, 1500); $('#success').fadeIn(); } 
              }  
          }); 
          return false; 
      }); 
  </code></pre>
  
  <p>The PHP does this:</p>
  
  <pre><code>$email = htmlspecialchars(trim(urldecode($_POST['email']))); 
  $act = htmlspecialchars(trim(urldecode($_POST['act'])));
  $first = mysql_query("UPDATE members SET active = '1' WHERE active_code = '$act' AND email = '$email' ");
  $second = mysql_query("UPDATE member_search SET active = '1' WHERE email = '$email' ");
  
  if(is_bool($first) == true &amp;&amp; is_bool($second) == true)
  {
  $response = array(success =&gt; true); 
  echo json_encode($response); 
  }
  else
  {
  $response = array(success =&gt; false); 
  echo json_encode($response); 
  }
  </code></pre>
  
  <p>the "loadingB" div fades in but never fades out to return successful or failure. I believe this is a PHP error. I don't think I'm correctly obtaining if the mysql-query returned true or false.</p>
  
  <p>I know the proper data is being collect by the JQuery because I even echoed it just to make sure, the PHP is just not doing anything with it.</p>