我在 MVC 5 中使用 DataTables.net 并返回 JsonResult。页面显示 table 结构但未加载任何 data.Please 看看我的代码

I am using DataTables.net with MVC 5 and returning JsonResult. Page is showing table structure but not loading any data.Please have a look at my code

我做了所有事情,比如在 datatables.js 之前添加 jquery,更改 datatable 的设置。仍然没有用。请帮帮我:

<script type="text/javascript">
    setTimeout(function () {
        location = ''
    }, 60000)
    $(function () {
       
        $('#datatable').DataTable({
            "ajax": "EmployeeDetails",
            "aoColumns": [
               { "mData": "EmpID" },
               { "mData": "EmpName" },
               { "mData": "EmpMobile" },
               { "mData": "OSName" },
               { "mData": "OSVersion" },
               { "mData": "BrowserName" },
               { "mData": "Platform" },
               { "mData": "DeviceUID" }
            ]
        });

    });
</script>
<table id="datatable" class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th>Employee ID</th>
                    <th>Name</th>
                    <th>Mobile</th>
                   
                    <th>OS Name</th>
                    <th>OS Version</th>
                    <th>Browser Name</th>
                     <th>Platform</th>
                    <th>Device UID</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th>Employee ID</th>
                    <th>Name</th>
                    <th>Mobile</th>
                   
                    <th>OS Name</th>
                    <th>OS Version</th>
                    <th>Browser Name</th>
                    <th>Platform</th>
                    <th>Device UID</th>
                </tr>
            </tfoot>
        </table>
    </div>
</div>

我正在使用 Coreect

的 EmployeeDetails 方法返回 json 字符串

终于我找到了解决方案,实际上我在捆绑包和页面上也包含了两次 jquery!从捆绑包中删除确实对我有用!感谢您的建议。此外,我将数据tables 应用到默认 MVC table 结构,它也有效!