title: Feed ajax datatable with json from Asp.net MVC Action method
body: <p>I am using Ajax Datatable, I want to feed the table with Json data, which i am returning from MVC Action method. This is what i have tried so far,</p>
  
  <p>My Controller action method</p>
  
  <pre><code>public ActionResult Index()
  {
      _dbcontext = new dbContext();
      List&lt;Employee&gt; employees = new List&lt;Employee&gt;();
      var query = (from e in _dbcontext.Employees select new { e.FirstName, e.LastName, e.Username, e.Password }).ToList();
      return Json(query,JsonRequestBehavior.AllowGet);
  }
  </code></pre>
  
  <p>And here is my Javascript on Index page</p>
  
  <pre><code>&lt;/script&gt;
      $(document).ready(function () {
          $('#example').dataTable({
              "processing": true,
              "serverSide": true,
              "ajax": {
                  "url": "Home/Index",
                  "dataType": "jsonp"
              }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>But on page load only the plain Json data can be seen  and no data table, I think It is not even rendering the Html on the index page and hence neither Datatable as I can not see anything in chrome debugger.</p>
  
  <p>Also, Html and script referencing is all Ok as I can see the results when I feed the datatable from a .txt file having array of data.</p>
  
  <p>I don't know what is the right way to do that, If somebody has the solution for that, then please help, Thanks.</p>