title: Ajax + PHP: null instead of an array
body: <p>Ajax call is made in the background</p>
  
  <pre><code>var signupValidate = function(elementID){
    var value = $('#' + elementID).val();
    if (value !== ''){
      $('#'+elementID+'-status').css("background-image", "url(img/signup/spinner.gif)");
      var data = {elementID: value};
      var json = JSON.stringify(data);
      $.ajax({
        url: 'php/validator_signup.php',
        dataType: 'json',
        type: 'post',
        data: json,
        success: function(data){
          var parsedResponse = JSON.parse(data);
          console.log(parsedResponse);
          /*
                  if(data.response === 1){
                      $('#'+elementID+'-status').css("background-image", "url(img/signup/no.png)");
                  }else if(data.response === 0){
                      $('#'+elementID+'-status').css("background-image", "url(img/signup/yes.png)");              }
              */
        }
  
      });
    }
  }
  </code></pre>
  
  <p>validator_signup.php received the call. So far in test mode PHP will receive the string, parse it and encode again to return to JS:</p>
  
  <pre><code>$post = $_POST['data'];
  $data = json_decode($post, true); //decode as associative array
  $details = $data[0];
  echo json_encode($details);
  </code></pre>
  
  <p>JS then needs to print this in console.</p>
  
  <p>I get this:</p>
  
  <pre><code>null
  </code></pre>
  
  <p>instead of the value which I expect back.</p>
  
  <p>Result is same whether I parse returned data or not.</p>
  
  <p>If I understand it correctly, the problem is on PHP side?</p>