title: Ajax post - POST array is returning empty on server side
body: <p>I have an js function that is collecting data and sending it to a php file.</p>
  
  <p>I am trying to submit an array as part of the post:</p>
  
  <p>function send_registration_data(){</p>
  
  <pre><code>var string = "{username : " + $('#username').val() + ", password : " + $('#pass1').val() + ", level : " + $("#userrole").val() + ", 'property[]' : [";
  var c = 0;
  $('input[name=property]:checked').each(function(){
      if( c == 0){
          string +="\"" +this.value+"\"";
          c=1;
      } else {
          string +=",\""+this.value+"\"";
      }
  });
  string+="]}";
  $('#input').html( JSON.stringify(eval("(" + string + ")")) );
  
  $.ajax({ url: './php/submit_registration.php',
           //data: { username : $('#username').val() , password : $('#pass1').val() , email : $('#email').val() , level : $("#userrole").val() },
           data: JSON.stringify(eval("(" + string + ")")) ,
           type: 'post',
           success: function(output) {
                    $('#output').html( output );
  
              }
  });
  };
  </code></pre>
  
  <p>On submit my php file returns an the POST array as NULL. I am not sure what I am doing wrong here. </p>
  
  <p>EDIT: IT is the same weather I try to convert the string to json or not.</p>
  
  <p>ALso, the inputs contain just text names.</p>