Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery datatables Ajax-Error / http://datatables.net/tn/7

Please look at my problem below:

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.

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:

http://ziehl-abegg.com/files/work.jpg

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

http://ziehl-abegg.com/files/work_not.jpg

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

Thank you.

Greetz Vegeta_77

like image 359
Vegeta_77 Avatar asked Mar 04 '15 14:03

Vegeta_77


People also ask

What is an Ajax warning?

When using the ajax option to load data for DataTables, a general error can be triggered if the server responds with anything other than a valid HTTP 2xx response.

What is data table warning?

DataTables warns about the use of them by default, as the majority of the time they are not intended for display - for example, rather than showing null in the table, you might want to show Not yet set, or simply an empty string (empty cell). For this, DataTables has a columns.


1 Answers

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

Here is the Solution:

$(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" }
        ]
    } );
} );

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

Thank you very much.

Greetz Vegeta_77

like image 97
Vegeta_77 Avatar answered Oct 10 '22 21:10

Vegeta_77