Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 480.8k

Data-Table not showing on the record than json format

Oct 6 2020 4:57 AM
Hi Team
 
I want my View be on the dataTable and using it, but the record is return as json format. How do i fix this issue?
  1. @{  
  2.     ViewBag.Title = "People_Lists";  
  3. }  
  4.   
  5. <link href="~/Content/bootstrap.min.css" rel="stylesheet" />  
  6. <script src="~/Scripts/jquery-3.5.1.min.js"></script>  
  7. <script src="~/Scripts/bootstrap.min.js"></script>  
  8. <link href="~/Content/bootstrap.min.css" rel="stylesheet" />  
  9. <script src="~/Scripts/jquery.dataTables.min.js"></script>  
  10. <script src="~/Scripts/dataTables.bootstrap4.min.js"></script>  
  11.   
  12. <script type="text/javascript">  
  13.   
  14.     $(document).ready(function () {  
  15.         $('#dataTable').DataTable({  
  16.             "ajax": {  
  17.                 "url""/Home/GeteNtsaDataResults",  
  18.                 "type""GET",  
  19.                 "datatype""json"  
  20.             },  
  21.             "columns": [  
  22.                 { "data""LoginID" },  
  23.                 { "data""Name" },  
  24.                 { "data""SSID" },  
  25.                 { "data""Section" },  
  26.                 { "data""Role" },  
  27.                 { "data""LastActivity" },  
  28.                 { "data""TotalActivity" }  
  29.             ]  
  30.         });  
  31.     });  
  32. </script>  
  33.   
  34. <div class="container py-4">  
  35.     <h4 class="text-center text-uppercase"></h4>  
  36.     <div id="dataTable_wrapper"></div>  
  37.     <table id="dataTable" class="table table-bordered table-striped">  
  38.         <thead>  
  39.             <tr>  
  40.                 <th>LoginID</th>  
  41.                 <th>Name</th>  
  42.                 <th>SSID</th>  
  43.                 <th>Section</th>  
  44.                 <th>Role</th>  
  45.                 <th>LastActivity</th>  
  46.                 <th>TotalActivity</th>  
  47.             </tr>  
  48.         </thead>  
  49.     </table>  
  50. </div>  
 

Answers (10)