title: MVC ajax returns Requested unknown parameter error
body: <pre><code>$(document).ready(function () {
      $("#getViewReportButton").click(function () {
          //alert("drop down = " + $('#ReportSelected').find(":selected").text());
          viewReports($('#ReportSelected').find(":selected").val());
      });
  });
  
  function viewReports(reportSelected) {
      var controller = "PortalReports";
      alert("View Reports = " + reportSelected);
      var tableSelector = "#datatable";
  
      var table = $(tableSelector).DataTable({
          "ajax": {
              "url": $("#basePath").val() + controller + "/GetReport"
  
              /*,    "dataScr": "data",
              "columns": [
                  { "data": "MiPolicyTransactionId" },
                  { "data": "PolicyReference" },
                  { "data": "AgencyCode" }]*/
          }
      });
  }
  
  public JsonResult GetReport()
          {
              _context = new ReportDB();
  
  
              var result = _context.MiPolicyTransactions.Take(10).ToList();
  
              var theResults =
                  result.Select(
                      x =&gt;
                          new
                          {
                              MiPolicyTransactionId = x.MiPolicyTransactionId,
                              AgencyCode = x.AgencyCode,
                              CompanyId = x.CompanyId
                          }).ToList();
  
              //var results = new { value = 3, text = "Hello" };
              return Json(new { data = theResults}, JsonRequestBehavior.AllowGet);
          }
  
  
  &lt;h2&gt;@ViewBag.Title&lt;/h2&gt;
  &lt;p&gt;Please choose a Report:&lt;/p&gt;
  &lt;form  id="reportForm" method="post"&gt;
      &lt;div class="fieldRow ui-widget-content ui-corner-all"&gt;
          &lt;div class="field"&gt;
              @Html.DropDownListFor(x =&gt; x.ReportSelected, Model.ReportOptions, "Please Select")
              &lt;input id="getViewReportButton" type="submit" value="View Report" /&gt;
              &lt;span id="searchLoader" class="ajaxLoader"&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;br /&gt;
  &lt;table  id="datatable" class="display DataTable"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;MiPolicyTransactionId&lt;/th&gt;
              &lt;th&gt;PolicyReference&lt;/th&gt;
              &lt;th&gt;AgencyCode&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;&lt;/tbody&gt;
  
  &lt;/table&gt;
  </code></pre>
  
  <p>I have the above code which wont render and gives the Requested unknown parameter '0' for row 0. For more information about this error, please see <a href="http://datatables.net/tn/4" rel="nofollow noreferrer">http://datatables.net/tn/4</a></p>
  
  <p>I've tried in vain to change a bunch of parameters but just cant get the thing to work.</p>
  
  <pre><code>{data: [{MiPolicyTransactionId: 18, AgencyCode: "CJPTEST", CompanyId: "BQ"},…]}
  data
  :
  [{MiPolicyTransactionId: 18, AgencyCode: "CJPTEST", CompanyId: "BQ"},…]
  0
  :
  {MiPolicyTransactionId: 18, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  1
  :
  {MiPolicyTransactionId: 19, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  2
  :
  {MiPolicyTransactionId: 20, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  3
  :
  {MiPolicyTransactionId: 21, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  4
  :
  {MiPolicyTransactionId: 22, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  5
  :
  {MiPolicyTransactionId: 23, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  6
  :
  {MiPolicyTransactionId: 24, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  7
  :
  {MiPolicyTransactionId: 25, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  8
  :
  {MiPolicyTransactionId: 26, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  9
  :
  {MiPolicyTransactionId: 27, AgencyCode: "CJPTEST", CompanyId: "BQ"}
  </code></pre>
  
  <p>The XHR Preview looks fine as above but just disappears when the alert boxes giving the error are closed, I just cant think of anything else!</p>
  
  <p><strong>First error</strong>
  <a href="https://i.stack.imgur.com/uKC5E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uKC5E.jpg" alt="First error"></a></p>
  
  <p><strong>Second error</strong>
  <a href="https://i.stack.imgur.com/KCqFG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KCqFG.jpg" alt="Second error"></a></p>
  
  <p><strong>Goes to this</strong></p>
  
  <p><a href="https://i.stack.imgur.com/zcVeS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zcVeS.jpg" alt="Goes to this"></a> </p>