<div class="col-12">
  <div class="card card-primary card-outline" id="content-box-1">
    <div class="card-body" id="content-tabel-1">
    </div>
  </div>
</div>

<script type="text/javascript">
  var base_url        = url.protocol+'<?php echo str_replace("http:", "", base_url()); ?>';
  var controller_url  = base_url+'<?php echo $this->uri->segment(1); ?>';
</script>

<script type="text/javascript">

  $(document).ready(function(){
    satu_sehat();
  })  

  // setInterval(function()
  // {
  //   satu_sehat();
  // }, 30000);

  function satu_sehat()
  {
    var service_name = ['encounter', 'condition', 'observation']; 

    $('#content-tabel-1').append('<table class="table table-sm table-bordered table-striped table-hover"></table>')

    service_name.forEach(function(value){
      $.ajax({
        url:base_url+'/satusehat_data_'+value+'/kirim_semua_json',
        type: 'POST',
        success: function(response)
        {      
         response.data.forEach(function(value){ console.log(value);
         })
        },
        error: function (xhr, ajaxOptions, thrownError) { 
          console.log(xhr.responseText);
        }
      });
    });
  }
</script>