how to get added key in server side

how to get added key in server side

imurbatman12imurbatman12 Posts: 2Questions: 1Answers: 0

this is what my server side return

{"sEcho":0,"iTotalDisplayRecords":0,"iTotalRecords":4119,"totalQty":12,"aaData":[]}

i want to log the totalQty

var table = $('#example').DataTable({
            //"order": [[ 1, "asc" ]],
            "bSort" : false,
            "bFilter": true,
            "dom": '<"wrapper"flipt>',
            "serverSide": true,
            "processing": true,
            "ajax": {
                'type' : 'GET',
                'url' : base_url+'Phoenix/ssPhoenix',
                data : function(d){
                    d.comp = "PPH",
                    d.agent = $("#vwAgent").val(),
                    d.stat = $(".sel-stat").parent().attr("title")
                },
                                function (data, callback, settings) {
                      console.log(totalQty);
                   }
        });

i want to use that totalqty, so i want to know how to get it.

Answers

  • imurbatman12imurbatman12 Posts: 2Questions: 1Answers: 0
    edited May 2017

    1

  • bindridbindrid Posts: 730Questions: 0Answers: 119
      I added the dataFilter section which is a part of ajax.
    
      var table = $('#example').DataTable({
                //"order": [[ 1, "asc" ]],
                "bSort": false,
                "bFilter": true,
                "dom": '<"wrapper"flipt>',
                "serverSide": true,
                "processing": true,
                "ajax": {
                    'type': 'GET',
                    'url': base_url + 'Phoenix/ssPhoenix',
                    data: function (d) {
                        d.comp = "PPH",
                        d.agent = $("#vwAgent").val(),
                        d.stat = $(".sel-stat").parent().attr("title")
                    },
                    dataFilter: function (resp) {
                        // depending on your setup, you may or may not have to do this next step
                        var res = JSON.parse(resp);
                        console.log(res.totalQty);
                        return resp;
                    }
                }
            });
    
This discussion has been closed.