PHP Developers Network
http://forums.devnetwork.net/

Datatable Multiple Post Using different param
http://forums.devnetwork.net/viewtopic.php?f=13&t=142177
Page 1 of 1

Author:  Grandong [ Thu Jan 14, 2016 1:49 pm ]
Post subject:  Datatable Multiple Post Using different param

Hi.. i have datatable code like this:
Syntax: [ Download ] [ Hide ]
$('#example').DataTable({
  "paging": false,
  "bInfo": false,
  "searching": false,
  "columnDefs": [
    { targets: 'no-sort', orderable: false }
  ],
  "language": {
      "processing": "Wait",
      "emptyTable": "Ups..",
  },
// Start POST
    "processing": true,
    "ajax": {
        "url": "{{url('flights/dosearch')}}",
        "type": "POST",
        "data": {
          _token: "{{ csrf_token() }}",
          airline: "{{$airline->post_uri}}",
          from: "{{Request::input('from')}}",
          to: "{{Request::input('to')}}",
          depart: "{{Request::input('depart')}}",
          return: "{{Request::input('return')}}",
          adult: "{{Request::input('adult')}}",
          child: "{{Request::input('child')}}",
          infant: "{{Request::input('infant')}}",
        }
    },
    "columns": [
        { "data": null,
    "render" : function ( data, type, full ) {
      return "<ul class='no-bullet'><li><img src='{{asset('dist/airline')}}/"+full['segment'][0]['airline_code']+".png' width='50'><li><li><small>"+full['segment'][0]['fno']+"</small><li></ul>";
    },
    "sClass": "text-center"
 
        },
    {"data": null,
      "render" : function ( data, type, full ) {
        return "<ul class='no-bullet'><li>"+full['segment'][0]['from']+"<li><li><small>"+full['segment'][0]['std']+"</small><li></ul>";
      },
      "sClass": "text-center"
    },
    { "data": null,
      "render": function ( data, type, full ) {
        var c_s = full['segment'].length;
        if (c_s == 3) {
          return "<ul class='no-bullet'><li>"+full['segment'][2]['to']+"<li><li><small>"+full['segment'][2]['sta']+"</small><li></ul>";
        } else if (c_s == 2) {
          return "<ul class='no-bullet'><li>"+full['segment'][1]['to']+"<li><li><small>"+full['segment'][1]['sta']+"</small><li></ul>";
        } else {
          return "<ul class='no-bullet'><li>"+full['segment'][0]['to']+"<li><li><small>"+full['segment'][0]['sta']+"</small><li></ul>";
        }
    },
      "sClass": "text-center"
    },
        { "data": null,
      "render": function ( data, type, full ) {
        var c_s = full['segment'].length;
        if (c_s == 3) {
          return "<ul class='no-bullet'><li>2 Transit<li></ul>";
        } else if (c_s == 2) {
          return "<ul class='no-bullet'><li>1 Transit<li></ul>";
        } else {
          if (full['segment'][0]['stop_over'] > 0) {
              return "<ul class='no-bullet'><li>"+full['segment'][0]['stop_over']+" Stops<li></ul>";
            } else {
              return "<ul class='no-bullet'><li>NoneStop<li></ul>";
            }
        }
      },
      "sClass": "text-center"
        },
        { "data": "nta",
      "render": function ( data, type, full, meta ) {
          return "<ul class='no-bullet'><li>Rp. "+tandaPemisahTitik(data)+"<li></ul>";
      },
      "sClass": "text-center"
        },
        { "data": null,
      "render": function ( data, type, full, meta ) {
          // return "<a href='#' class='button tiny success'>Bookk Now</a>";
          return '<form action="{{url('flights/booking')}}" method="POST"><input type="hidden" name="_token" value="{{ csrf_token() }}"><input type="hidden" name="depart_data" value='+JSON.stringify(full['segment'])+'><input type="hidden" name="depart_nta" value='+full['nta']+'><input type="hidden" name="depart_total" value='+full['total']+'><input type="hidden" name="depart_margin" value='+full['margin']+'><input type="hidden" name="searchinfo" value="{{$searchinfo}}"><button type="submit" class="button tiny success">Bookk Now</button></form>';
      },
      "sClass": "text-center"
        },
    ],
    "order": [[ 4, "asc" ]],
});

How i can loop the ajax post with different airline data and show in the same table id ?

Sorry for my bad english and fyi: iam newbie,,,

Thx Very much before..

Author:  Grandong [ Sat Jan 16, 2016 3:52 pm ]
Post subject:  Re: Datatable Multiple Post Using different param

Help Me Please...

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/