Change output of the object from server

Change output of the object from server

klermannklermann Posts: 277Questions: 67Answers: 1

Is it possible to change the format of the output object to the server because in that format I am not being able to receive the object and where do I enter the console.log () within that submission to see the output on the console?

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    It is not clear to me what you are trying to do. If all you are trying to do is see what is being sent to the server, you can use the beforeSend as shown below.

                var table = $('#example').DataTable({
                    "processing": true,
                    "serverSide": true,
    
                    "columns":  [
                        { "data": "name" , name:"my name"},
                        { "data": "position" },
                        { "data": "office" },
                        { "data": "extn" },
                        { "data": "start_date" },
                        { "data": "salary" }
                    ],
                    "select":"multi",
                    "lengthMenu": [5, [10, 15, 25, 50, -1], [5, 10, 15, 25, 50, "All"]],
                    "pageLength": 5,
                    "ajax": {
                        contentType: "application/json; charset=utf-8",
                        url: "wsSample.asmx/GetDTDataUnserializedObject",
                        type: "Post",
                        // compensate for where .net puts the data in the d object
                        dataSrc:"d.data",
                        data: function (dtParms) {
                     
                            // notice dtParameters exactly matches the web service parameter name
                            return JSON.stringify({ dtParameters: dtParms });
                        },
    
                        beforeSend: function ( jqXHR,  settings) {
                            console.log(settings);
                        },
                        error: function (error) {
                            console.log(x);
                        }
                    },
                    order: [[0, 'asc']]
                });
    
  • klermannklermann Posts: 277Questions: 67Answers: 1

    But, i use the DataTables Editor!

  • klermannklermann Posts: 277Questions: 67Answers: 1
    edited July 2017

    "?"

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    Use preSubmit or ajax.data to modify the data that is being sent to the server. The documentation for the format Editor uses is available here.

    Allan

This discussion has been closed.