Advertisement
jamboljack

Get ID Pokmas

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