日期:2014-05-17  浏览次数:20431 次

jquery easy ui datagrid获取不了数据
本帖最后由 summer16md 于 2013-06-12 12:29:08 编辑

<body>
    <div>
        <table id="myTable"></table>
    </div>
</body>


    <script type="text/javascript">
        $(function () {
            $('#myTable').datagrid({
                title: 'datagrid',
                url: 'datagrid_data.ashx',
                idField: 'id',
                width: 400,
                columns: [[
                    { field: 'name', title: '名字', width: 100 },
                    { field: 'age', title: '年龄', width: 100 },
                    { field: 'sex', title: '性别', width: 100 }
                ]],
                pagination: true,
                pageSize: 10,
                pageList: [10, 20, 30, 40, 50]
            });

            $.ajax({
                url: 'datagrid_data.ashx',
                data: 'aa:1',
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    console.info(data);
                }
            });
        })
    </script>


datagrid_data.ashx:

        public void ProcessRequest(HttpContext context)
        {
          &n