PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Jun 15, 2019 10:41 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jan 14, 2016 1:49 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 03, 2014 12:35 pm
Posts: 65
Location: Indonesian
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..

_________________
Newbie The Passion for Learning


Top
 Profile  
 
PostPosted: Sat Jan 16, 2016 3:52 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 03, 2014 12:35 pm
Posts: 65
Location: Indonesian
Help Me Please...

_________________
Newbie The Passion for Learning


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group