title: jQuery dataTables - passing json stringified data to server
body: <p>I need to send custom data, in a JSON stringified format along with the regular data for every ajax call to the server.</p>
  
  <p>Here is my javascript code,</p>
  
  <pre><code>   $('#dataList').dataTable({
          "bFilter": false,
          "bSort": false,
          "bAutoWidth": true,
          "iDisplayLength": 20,
          "sPaginationType": "full_numbers",
          "bProcessing": true,
          "bServerSide": true,
          "sAjaxSource": "/ViewGenerator/GetPagedViewData",
          "sServerMethod": "POST",
          "fnServerParams": function (aoData) {
              var name = $('#viewName').val();
              var viewId = $('#viewId').val();
              var description = $('#viewDescription').val();
              var viewInfo = JSON.stringify(currentviewInfo);
              aoData.push({ "name": "viewId", "value": viewId });
              aoData.push({ "name": "viewName", "value": name });
              aoData.push({ "name": "viewDescription", "value": description });
              aoData.push({ "name": "viewInfo", "value": viewInfo });
          },
          "fnRender": function (oObj) {
              for (var i = 0; i &lt; oObj.length; i++) {
                  console.log(oObj[i]);
              }
          }
      });
  </code></pre>
  
  <p>The controller's signature is : </p>
  
  <pre><code>public JsonResult GetPagedViews(int? iDisplayStart = 0, int? iDisplayLength = 0, int? sEcho = 0, string viewId = null, string viewName = null, string viewDescription = null, viewInfo viewInfo = null)
      {
  </code></pre>
  
  <p>When i view the js errors in chrome developer tool, i find a Bad Request (400) being made,
  i am not able to find the exact location of the buggy code. Also, how can i set the application type to application/json for each of the datatables ajax calls.</p>