<table id="tabla_principal" class="table table-hover">
      <thead>
        <tr>
          <th>RUT</th>
          <th>NOMBRES</th>
          <th>APELLIDO PATERNO</th>
          <th>APELLIDO MATERNO</th>
        </tr>
      </thead>
      <tbody>
          <?php
          
          foreach($listado_personas as $fila)
          {
              echo "<tr pk='".$fila->rut."' onmouseover=\"$(this).css('cursor','pointer')\" onmouseout=\"$(this).css('cursor','default')\" >";
              echo "<th scope='row'>".$fila->rut."-".$fila->dv."</th>";
              echo "<td>".$fila->nombres."</td>";
              echo "<td>".$fila->ap_paterno."</td>";
              echo "<td>".$fila->ap_materno."</td>";
              echo "</tr>";
          }
          ?>
      </tbody>  
</table>


<script>
    $(document).ready(function(){
        $('#tabla_principal').on('click', 'tr', function () {
            var pk=$(this).attr('pk');
            var parametros={"pk":pk};
            $.ajax({
                data:  parametros,
                url:   '<?php echo base_url();?>index.php/inicio/editar_persona',
                type:  'post',
                async:false,
                success:  function (response) {                
                    $('.modal-content').html(response); 
                    $('#ventana_modal').modal('show');
                }
           });            
        });        
        
    });
</script>