title: AJAX Function jQuery to PHP Access Response Variables
body: <p>I am trying to send an AJAX function from jQuery to PHP. I can get it to the right page fine, but when I get there, how do I access the data from the AJAX call? It's probably something silly I'm missing.</p>
  
  <p>jQuery:</p>
  
  <pre><code>$(document).ready(function() {
  
      $("#assessform_page").on("submit", "#assessform", function(e) {
          e.preventDefault();
          var assessrows = {};
          var url = $(this).attr("action");
  
          $("div[data-test-num]").attr("data-test-num", function(index, value) {
              assessrows[value] = {};
              $(this).children("input[data-tab-row], select[data-tab-row]").attr("data-tab-row", function(i, v) {
                  assessrows[value][v] = $(this).val();
              });
              $(this).children("label[data-tab-row]").attr("data-tab-row", function(i, v) {
                  assessrows[value][v] = $(this).text();
              });
          });
  
          $.ajax({
              url: url,
              data: assessrows,
              type: "POST",
              success: function() {
                  window.location.href = url;
              },
          });
  
      });
  
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form id="assessform" action="assessment.php" method="post" enctype="application/x-www-form-urlencoded" name="assessform"&gt;
      &lt;div data-test-num="1"&gt;
          &lt;label data-tab-row="objname"&gt;First Value: &lt;/label&gt;
          &lt;select autofocus="autofocus" data-tab-row="status"&gt;
              &lt;option value="not_started"&gt;Not started&lt;/option&gt;
              &lt;option value="in progress"&gt;In Progress&lt;/option&gt;
              &lt;option value="obstacles"&gt;Obstacles&lt;/option&gt;
              &lt;option value="excluded"&gt;Excluded&lt;/option&gt;
              &lt;option value="done"&gt;Done&lt;/option&gt;
          &lt;/select&gt;
          &lt;input type="text" data-tab-row="numer" value="" /&gt;
          &lt;input type="text" data-tab-row="denom" value="" /&gt;
          &lt;br /&gt;
          &lt;br /&gt;
      &lt;/div&gt;
      &lt;button type="submit" name="submit-button" id="submit-button"&gt;Submit&lt;/button&gt;&lt;br /&gt;
      &lt;button type="button"&gt;Save&lt;/button&gt;&lt;br /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <p><code>&lt;?php ?&gt;</code> (I can't really do anything until I get this variable.)</p>
  
  <p>What variable do I call to get the data from the AJAX, and what function, if any, do I need to call before I can do that?</p>