本文介绍了jQuery的数据表Ajax的错误/ http://datatables.net/tn/7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看看下面我的问题:

我在MVC的Web-Applikation jQuery的数据表使用。当我只显示8列,一切工作正常。但随着1多个列,我得到了Ajax的错误消息,请参见称号。

I use in my MVC-Web-Applikation the jquery datatables. When i display only 8 columns, everything works fine. But with 1 more column, i get the ajax-error-message, see title.

控制器wokrs罚款,因为8列做工精细。在这里,鉴于我的code:

The controller wokrs fine, because the 8 columns work fine. Here my code of the view:

<script type="text/javascript">
    $(document).ready(function () {
        var table = $('#example').DataTable({
            "processing": true,
            "serverSide": true,
            "ajax": "@Url.Action("List", "DFS_Akustik")",
            "columns": [
                { "data": "ID" },
                { "data": "MessID" },
                { "data": "KL_ID" },
                { "data": "MP_ID" },
                { "data": "LwLin50ss" },
                { "data": "LwLin63ss" },
                { "data": "LwLin80ss" },
                { "data": "LwLin100ss" },
                //{ "data": "LwLin125ss" },
            ],
        });
    });
</script>

可以的,即最后一栏是不活动的,则:

You can the, that the last columns is not active, then:

当我delte的最后一列的//,则:

When i delte the // of the last column, then:

我怎样才能解决这个问题?请帮我...我寻找一个解决方案,因为周一一整天!

How can i solve this problem?? Please help me... I look for a solution, since Monday, the whole day!!

感谢您。

格尔茨
Vegeta_77

GreetzVegeta_77

推荐答案

我有它,我的朋友!!!!!!!!!!!!!!!!!!!!!!!
很不错的: - )

I have it, my friends!!!!!!!!!!!!!!!!!!!!!!!Very NICE :-)

下面是解决方案:

$(document).ready(function() {
    $('#example').dataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": {
            "url": "scripts/post.php",
            "type": "POST"
        },
        "columns": [
            { "data": "first_name" },
            { "data": "last_name" },
            { "data": "position" },
            { "data": "office" },
            { "data": "start_date" },
            { "data": "salary" }
        ]
    } );
} );

我刚刚编辑Ajax的。当您使用类型,POST,那么它​​的工作原理。

I had just to edit the "ajax". When you use the "type" "POST", then it works.

非常感谢你。

格尔茨
Vegeta_77

GreetzVegeta_77

这篇关于jQuery的数据表Ajax的错误/ http://datatables.net/tn/7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 00:06