title: How to pass extra parameter on AJAX call of jQuery DataTable
body: <p>I pass the parameters using the following code as indicated on <a href="https://datatables.net/reference/option/ajax" rel="nofollow">DataTable Documentation</a>.  </p>
  
  <p><br/></p>
  
  <p><strong><em>View:</em></strong></p>
  
  <pre><code>$('#example').dataTable( {
        "ajax": {
             "url": "/Student/GetStudents",
             "data": function ( d ) {
                 d.test= "some data";
             }
        }
  });
  </code></pre>
  
  <p><strong><em>Controller:</em></strong></p>
  
  <pre><code>public ActionResult GetStudents(JQueryDataTableParamModel param, string test)
  {
      //code omitted for brevity
  
      return Json(new
      {
          sEcho = param.sEcho,
          iTotalRecords = allRecords.Count(),
          iTotalDisplayRecords = filteredRecords.Count(),
          aaData = result
      },
      JsonRequestBehavior.AllowGet);
  }
  </code></pre>
  
  <p>Although the "test" parameter is passed to the Controller, the values in the "param" parameter are null or 0 and that causing the datatable returns null data. On the other hand, if I use the following line instead of AJAX call in datatable parameters, all the values of param are passed to the Controller properly (but using AJAX call and this line also causes error). I need to pass extra parameter to the Controller and have to use AJAX call. How can I pass it while passing param values?</p>
  
  <pre><code>"ajaxSource": "/Student/GetStudents",
  </code></pre>