 <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark">Assign Batch</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item"><a href="#">Student</a></li>
              <li class="breadcrumb-item active">Assign Batch</li>

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
    <?php echo form_open(base_url().'admin/students/add_new_batch');?>
    <section class="content">
      <div class="container-fluid">
        <div class="card card-default">
          <div class="card-header">
            <div class="card-tools">
              <select class="form-control" onchange="batch_details(this.value)" name="batch_id">
                <option value="">Select A Batch Form List</option>
                <?php foreach ($all_batch as $batch): ?>
                  <option value="<?php echo $batch->batch_id; ?>"><?php echo $batch->batch_name; ?></option>
                <?php endforeach ?>
              </select>
              <button class="btn btn-success btn-xs">Save Changes</button>
            </div>
          </div>
            <!-- /.card-header -->
            <div class="card-body">
              <table id="example2" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Student Name</th>
                  <th>Reg No</th>
                  <th>Mobile No</th>
                  <th></th>
                </tr>
                </thead>
                <tbody id="data">
                  
                </tbody>
              </table>
            </div>
          </div>
      </div><!--/. container-fluid -->
    </section>
    <?php echo form_close();?>
    <!-- /.content -->
  </div>
<script type="text/javascript">
$(function () {
    $("#example2").DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,  "searching": true,
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
  });
function batch_details(e) {
  if(e != '')
  {
    $.ajax({
      beforeSend: function() {
         $(".loader").show();
      },
      type: "GET",
      dataType:"JSON",
      async: true,
      url: '<?php echo base_url(); ?>admin/students/get_batch_details_by_batch_id/'+e,
      success: function (data) 
      {

        $('#data').html(data);
          // $('#city').val(data.city);
          // $('#state').val(data.state);
          $(".loader").hide();
      },
      error: function (e) {
        console.log(e.responseText)
        $(".loader").hide();
      }
    });
  }
}
</script>
<style type="text/css">
.check-box
{

}
</style>