Advertisement
jamboljack

Show Data with Parameter ajax

Oct 23rd, 2017
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.     $.ajax({
  3.         url : "<?php echo site_url('operator/pokmas/get_id_pokmas/'.$this->uri->segment(4).'/'.$this->uri->segment(5).'/'.$this->uri->segment(6))?>",
  4.         type: "GET",
  5.         dataType: "JSON",
  6.         success: function(data) {
  7.             if (data === null) {
  8.                 pokmas_id = '';
  9.             } else {
  10.                 pokmas_id = data.pokmas_id;
  11.             }
  12.            
  13.             table = $('#tableData').DataTable({
  14.                 "paging": false, // HIlangkan Pagination
  15.                 "searching": false, // Hilangkan Search        
  16.                 "responsive": true,
  17.                 "processing": false,
  18.                 "serverSide": true,
  19.                 "order": [ 1, 'asc'],
  20.                 "ajax": {
  21.                     "url": "<?php echo site_url('operator/pokmas/data_list_pokmas')?>"+"/"+pokmas_id,
  22.                     "type": "POST"
  23.                 },
  24.                 "columnDefs": [
  25.                 {
  26.                     "targets": [ 0 ],
  27.                     "orderable": false,
  28.                 },
  29.                 ],
  30.             });
  31.         },
  32.         error: function (jqXHR, textStatus, errorThrown) {
  33.             alert('Error get data from ajax');
  34.         }
  35.     });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement