DataTables警告:无法解析来自服务器的JSON数据。这是由JSON格式错误引起的。 (ASP.NET)

时间:2013-03-19 08:58:42

标签: jquery asp.net-mvc c#-4.0 datatables

我在ASP.NET VS2010和C#.NET中作为后端语言工作,我没有使用MVC。 我从服务器端加载数据时遇到问题。它显示正确的行数但没有数据。我的JSON响应是有效的Json字符串。

任何人都知道如何解决这个问题???????

这是我回复的字符串

{"sEcho": 1,"iTotalRecords": 2,"iTotalDisplayRecords": 2,"aaData": [{"Name":"IT","DescEn":"Information Technology","DescAr":"testing","CreatedOn":"18-03-2013","CreatedBy":"1"},{"Name":"HR","DescEn":"Human Resource","DescAr":"testing","CreatedOn":"18-03-2013","CreatedBy":"1"}]}

这是html

<table id='example' class="datatable">
                <thead>
                    <tr>
                        <th>
                            Name
                        </th>
                        <th>
                            DescEn
                        </th>
                        <th>
                            DescAr
                        </th>
                        <th>
                            CreatedOn
                        </th>
                        <th>
                            CreatedBy
                        </th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>

这是一个JS脚本

$(document).ready(function () {
            var oTable = $('#example').dataTable({
                "bProcessing": true,
                "bServerSide": true,
                "bDestroy": true,
                "sPaginationType": "full_numbers",
                "aaSorting": [[1, "desc"]],
                "sAjaxSource": '<%= Page.ResolveClientUrl("Request/GroupPage.aspx") %>',
                "aoColumns": [
           { "aaData": "Name" },
            { "aaData": "DescEn" },
            { "aaData": "DescAr" },
            { "aaData": "CreatedOn" },
            { "aaData": "CreatedBy" }
        ]
            });
        });

任何人都知道如何解决这个问题????????