无法使用post方法将我的数据推送到数据表

时间:2019-02-03 18:28:28

标签: jquery .net json datatable datatables

当我的控制器从控制器返回我的json数据时,

     _yonetimRepo.Uniler();
        IList<YonetimModel.Universiteler> Uniler = _yonetimRepo.Uniler();
      return Json(new { data = Uniler }, JsonRequestBehavior.AllowGet);

这是我的html:

    <table id="example" class="display" style="width:100%">
<thead>
    <tr>
        <th>Id</th>
        <th>Üniversite</th>
    </tr>
</thead>
<tfoot>
    <tr>
        <th>Id</th>
        <th>Üniversite</th>
    </tr>
</tfoot>

    <script>
$(document).ready(function () {
    $('#example').DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": {
            "url": "Home/Yonet",
            "type": "POST"
        },
        "columns": [
            { "data": "Id" },
            { "data": "Universite" }
        ]
    });
});

毕竟我只是在html页面上将结果作为json数组,不能将数据推送到数据表中,请帮助我解决这个问题

0 个答案:

没有答案