title: Send multiple variables with PHP to AJAX over JSON doesnt work
body: <p>I have a problem. I want to send 3-4 variables from a PHP File to my AJAX request (over json)... and I'm sure that my code is right, it doesn't work. It is doing nothing. If I'm doing just a normal "echo" everything works finde, but json is not working?</p>
  
  <p>Here is my JS-code:</p>
  
  <pre><code>$.ajax({
         type: "POST",
         url: "test.php",
         data: "varA=" + varA + "&amp;varB=" + varB,
         dataType: json,
         cache: false,
         success: function(data1){
  
         alert(data1.b);
  
         if (data1.a == "success"){
         alert("OK");
  
         location.href = "index.html";
         }
  
         else{
         alert("Not OK");
         }
  
         }
         });
  </code></pre>
  
  <p>And here is my PHP-code:</p>
  
  <pre><code>...
      $qry="SELECT * FROM database1 WHERE varA='".$_POST['varA']."' AND varB='".$_POST['varB']."'";
  $result=mysql_query($qry);
  
  if($result) {
      if(mysql_num_rows($result) == 1) {
          $test = mysql_fetch_assoc($result);
          echo json_encode(array('a' =&gt; 'success', 'b' =&gt; $test['database_entry']));
  ...
  </code></pre>
  
  <p>I don't have a clue why this AJAX code would not be fired!
  Hope you could help me, THANKS!</p>