Datatable.js + POSTing data PHP
<p>I'm trying to setup my datatable to POST to the contents of it's rows into my PHP script so that I can store it in a database.</p>

<p>I have a working HTML page, which when I click "+ Add Mapping" a BS modal appears and I can add a row to the datatable.</p>

<pre><code>&lt;script&gt;
    $(document).ready(function() {
        var t = $('#parameters_config').DataTable();
        $('#add_new_mapping').on('click', function() {
            $('#add_field_mapping').modal('hide');
            var wb_field = $("#add_field_mapping #wb_field").val();
            var adobe_field = $("#add_field_mapping #adobe_field").val();
            t.row.add([
                adobe_field,
                wb_field,
            ]).draw();
            $('#add_new_field_mapping').trigger("reset");
        });
    });
&lt;/script&gt;
</code></pre>

<p>This all works perfectly. I now would like to retrieve all data rows and POST them to my script so that I can process the submitted data and store. So far, I've come up with this based on information provided:</p>

<pre><code> &lt;script&gt;
            $(document).ready(function() {
              $('#parameters').submit(function(event) {                   
                  var table = $('#parameters_config').DataTable();
                  var dataToSend = table
                    .rows()
                    .data();
                  console.log( 'Data', dataToSend);
                  alert( 'There are '+dataToSend.length+' row(s) of data in this table');
                  $.ajax({
                    type: 'POST',
                    url: '{$this-&gt;homeURL}',
                    data: dataToSend,
                    dataType: 'json',
                  });
              });
            });
        &lt;/script&gt;
</code></pre>

<p>In my console window I see the following returned for "dataToSend" but no actual data!</p>

<p>[Array[2], context: Array[1], selector: Object, ajax: Object]</p>

<p>Where am I going wrong?</p>