title: How do I pass additional parameters to the jQuery DataTable ajax call?
body: <p>When loading a jQuery DataTable, I have the code shown below.  How do I pass additional parameters to the AJAX call?  The fnServerParams callback suggested in the questions and answers below does not work.  That is, naively using <code>aodata.push()</code> results in "push is undefined" (because, indeed, aodata is not an array).  So what's the correct way to do this?</p>
  
  <p><strong>Related questions:</strong></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/q/26824732/188474">Datatables serverside. Send extra parameters asynchronously</a></li>
  <li><a href="https://stackoverflow.com/q/21704398/188474">Understanding fnServerData in Datatables</a></li>
  </ul>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>self.dataTable = self.dataTableContainer.DataTable({
              "autoWidth": false,
              "bSort": false,
              "displayStart": 0,
              "paging": false,
              "lengthChange": false,
              "processing": true,
              "serverSide": true,
              "dom": "&lt;'dataTables_header dashboard_alert_history__alertHeader'i&gt;",
              "ajax": {
                  url: getDataUri,
                  error: onError,
                  cache: false,
                  "fnDrawCallback": onTableDrawn,
              },
              "fnDrawCallback": onTableDrawn,
              "language": {
                  "info": resources.alarmHistory,
                  "infoEmpty": resources.alarmHistory,
                  "infoFiltered": ''
              },
              "columns": [
                  {
                      "data": "timestamp",
                      "mRender": function (data) {
                          return IoTApp.Helpers.Dates.localizeDate(data, 'L LTS');
                      },
                      "name": "timestamp"
                  },
                  {
                      "data": "deviceId",
                      "mRender": function (data) {
                          return htmlEncode(data);
                      },
                      "name": "deviceId"
                  },
                  {
                      "data": "ruleOutput",
                      "mRender": function (data) {
                          return htmlEncode(data);
                      },
                      "name": "ruleOutput"
                  },
                  {
                      "data": "value",
                      "mRender": function (data) {
                          return htmlEncode(IoTApp.Helpers.Numbers.localizeFromInvariant(data));
                      },
                      "name": "value"
                  },
              ],
              "columnDefs": [
                  {
                      "targets": [0, 1, 2, 3],
                      "className": 'table_alertHistory_issueType',
                      "width": "20%"
  
                  }
              ],
          });
  </code></pre>