I'm trying to pass this to a PHP script through AJAX:
  var answers={};
  for (x=0; x< allAnswers.length; x++)
   {
       answers.x=new Array();
       answers.x['id']==allAnswers[x]['id'];
       answers.x['val']=$("#field_" + x).val();
   }
   var data={};
   data.id=questions[qId]['id'];
   data['answers']=answers;
   $.post('index.php',data);
The PHP is set to print_r($_POST), and this is the output:
answers [object Object]
id       3
What am I done wrong?
Edit: Changing the code to use arrays, i.e:
  var answers=new Array();
   for (x=0; x< allAnswers.length; x++)
   {
       answers[x]=new Array();
       answers[x]['id']=allAnswers[x]['id'];
       answers[x]['val']=$("#field_" + x).val();
   }
   var data={};
   data.id=questions[qId]['id'];
   data['answers[]']=answers;
   $.post('index.php',data);
Gives this print_r:
Array
(
    [id] => 3
    [answers] => Array
        (
            [0] => 
            [1] => 
        )
)
Thoughts?