title: jQuery loop through table and get element
body: <p>i've got some form input elements in an html table like this:</p>
  
  <pre><code>&lt;table&gt;
      &lt;thead&gt;
      ....
      &lt;/thead&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;input type="text" name="n_time" id="5030c9261eca0" value="2012" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="n_name" id="5030c9261eca0" value="a name" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;textarea name="n_comment" id="5030c9261eca0"&gt;bla&lt;/textarea&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>now, i need to send this form data using <code>$.post</code> to my PHP processing page
  which looks something like</p>
  
  <pre><code>if($_POST['data']){
      $array = json_decode($_POST['data']);
  
  }
  </code></pre>
  
  <p>so i need to get all my form elements and somehow made then into JSON </p>
  
  <p>and this is what i did:</p>
  
  <pre><code>// assume i can get 5030c9261eca0 from my predefined vars...
  $my_array = $("#5030c9261eca0").map(function () { return $(this).is("input")?$(this).val():$(this).text(); } );
  //now convert
  JSON.stringify($my_array);
  // the conversion failed with : Uncaught TypeError: Converting circular structure to JSON 
  </code></pre>
  
  <p>this error poped up:</p>
  
  <pre><code>Uncaught TypeError: Converting circular structure to JSON 
  </code></pre>
  
  <p>how do i fix this?</p>
  
  <p>also, if i do regluar HTTP post via HTML forms, i can recieve form data like <code>$_POST['n_name']</code> in PHP if i have a HTML form element with attribute <code>n_name</code>, how can i accomplish the same with the above?</p>