codeigniter中jquery ajax中的员工休假计数值

codeigniter中jquery ajax中的员工休假计数值,jquery,ajax,codeigniter,Jquery,Ajax,Codeigniter,我想显示事假和事假中的计数值总数。例如,如果我选择了事假,事假总数为6,事假总数为12(在屏幕截图中的leavetype表中提及),以及他们必须使用的天数(在屏幕截图中的leave_应用表中提及) 这是我的jquery代码 <script type="text/javascript"> $(document).ready(function(){ $(function() { $('#select').change(function() {

我想显示事假和事假中的计数值总数。例如,如果我选择了事假,事假总数为6,事假总数为12(在屏幕截图中的leavetype表中提及),以及他们必须使用的天数(在屏幕截图中的leave_应用表中提及)

这是我的jquery代码

<script type="text/javascript"> 
  $(document).ready(function(){
    $(function() {
      $('#select').change(function()
      { 
        showval=$(this).val();  
        $.ajax({  
          type:'GET',
          url: '<?php echo $base_url;?>user/ajaxleave',         
          data : { 'employee_id': showval}, 
          success:function(data)
          {    
            countleave = $('.productprice-'+showval).val(data);  
            $('.show_selected').html(`Your Total leave: ${countleave}  and your remaining leave : ${countleave}`);
          },
        });          
      });
    });
  });
</script>
我的预期结果将是leavetype表中的总假期数,剩余假期将根据休假申请表计算:


添加模式而不是图像会更好。我的声誉很差,所以图像不会显示。不是图像。。。。我告诉过db schema…像create table一样,插入到那些sql命令中好吧…@MohammedShafeekwhy使用“duration”和“employeetype”列?
<div class="row">
          <div class="col-sm-12">
              <div>
                <label class="form-control-label">Leave Type</label>
                  <select name="leavetype" class="form-control" id="select">
                      <option value="select">Select</option>  
                        <?php foreach($leavetype as $leaveappln_info){ ?>
                        <option value="<?php echo $leaveappln_info->leavetype_id?>"><?php echo $leaveappln_info->leavetype_name; ?></option>
                        <?php } ?>  
                  </select>
              </div>
          </div>   
          <div class="show_selected"></div>
          <input type="hidden"  value="" id="hiddenval"> 
          <input type="hidden" value="" class="productprice" id="productprice">

          <div class="col-sm-12">
              <div>
                  <label class="form-control-label">Start Date</label>
                  <input type="date" name="start_date" class="form-control startdate" placeholder="Start Date" id="startdate" required onchange="cal()">
              </div>
          </div>
          <div class="col-sm-12">
              <div>
                  <label class="form-control-label">End Date</label>
                  <input type="date" name="end_date" class="form-control enddate" placeholder="End Date" id="enddate" required onchange="cal()">
              </div>
          </div>
          <div class="col-sm-12">
              <div>
                  <label class="form-control-label">Count Days</label>
                  <input type="text" name="count_days" class="form-control" placeholder="Count Days" id="countdays" readonly>
              </div>
          </div>
          <div class="col-sm-12">
              <div>
                  <label class="form-control-label">Reason</label>
                  <textarea name="reason" class="form-control" placeholder="Reason"> </textarea> 
              </div>
          </div>
      </div>
public function ajaxleave()
{
    $employee_id = $this->input->get('employee_id');     
    $this->db->where('leaveappln_id',$employee_id); 
    $result=$this->db->get('leave_application')->row();  

    $this->db->where('leavetype_id',$result->leavetype);
    $leavetype=$this->db->get('leavetype')->row();  
    echo $leavetype->leavetype_name;            
}