title: passing data to new page $_POST with jquery
body: <p>I have two tables and an input inside a form that more or less goes like this:</p>
  
  <p>the table code (the two tables are the same, except for a slight difference in what table it calls):</p>
  
  <pre><code>&lt;table cellpadding="0" cellspacing="0" class="paperTable searchResultContainer"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;ID&lt;/th&gt;
              &lt;th&gt;Company Reg.&lt;/th&gt;
              &lt;th&gt;Postcode&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
  
      &lt;tbody&gt;
          &lt;?php while ($row = $items-&gt;fetch_assoc()) : ?&gt;
              &lt;tr class="row" data-address1="&lt;?php echo $row['address1']; ?&gt;"
                  data-address2="&lt;?php echo $row['address2']; ?&gt;" data-address3="&lt;?php echo $row['address3']; ?&gt;"
                  data-county="&lt;?php echo $row['address4']; ?&gt;" data-postcode="&lt;?php echo $row['postcode']; ?&gt;"
              &gt;
                  &lt;td&gt;&lt;?php echo (strlen($row['name'])           &gt; 0 ? $row['name']           : '-'); ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo (strlen($row['id'])             &gt; 0 ? $row['id']             : '-'); ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo (strlen($row['company_reg_no']) &gt; 0 ? $row['company_reg_no'] : '-'); ?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo (strlen($row['postcode'])       &gt; 0 ? $row['postcode']       : '-'); ?&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;?php endwhile; ?&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>and my input is a simple one-liner checkbox that asks if none of the above matches the search..</p>
  
  <p>what I'm trying to do, if the user clicks a table row, it posts the .data() attributes of the <code>&lt;tr&gt;</code> tag to the next step in the form, which is another page.</p>
  
  <p>I've tried the hidden input idea, but because it's in a while loop where the inputs share the same name, the value of the input will be the last in the loop because it's last set. I've also tried ajax:</p>
  
  <pre><code>$.ajax({
      data:    $(this).data(),
      type:    'post',
      url:     'stepDos.php',
      success: function(data)
               {
                   window.location.replace('/path/to/stepDos.php');
               }
  });
  </code></pre>
  
  <p>which didn't work when I var_dumped $_POST it returned empty.</p>
  
  <p>I also tried a $.post function:</p>
  
  <pre><code>$.post('/path/to/stepDos.php', {data: data}, function(ev)
  {
      window.location.replace('/path/to/stepDos.php');
  });
  </code></pre>
  
  <p>again no avail - anything I'm missing?</p>
  
  <p>Thanks</p>