如何使用带有现有模态ajax的ajax创建搜索框?

问题描述 投票:-1回答:1

已经有模态ajax时如何使用ajax创建搜索框?

这是我的代码

<script>  
 $(document).ready(function(){
      $('.view_data').click(function(){  
           var employee_id = $(this).attr("id");  
           $.ajax({  
                url:"select.php",  
                method:"post",  
                data:{employee_id:employee_id},  
                success:function(data){  
                     $('#employee_detail').html(data);  
                     $('#dataModal').modal("show");
               
                }  
           });  
      });  
 });  
 </script>

这是用于布局的

<?php  
 if(isset($_POST["employee_id"]))  
 {  
      $connect = mysqli_connect("localhost", "root", "", "db_hkrenewal");  
      $query = "SELECT * FROM tbl_form WHERE student_number = '".$_POST["employee_id"]."'";  
      $result = mysqli_query($connect, $query);
      $search = mysqli_real_escape_string($connect, $_POST["query"]);
    
    }   
      
      
      while($row = mysqli_fetch_array($result))  
      {  
          ?>  <div class="table-responsive">  
                  <table class="table table-bordered">
                <tr>  
                     <td width="30%"><label>Student Number</label></td>  
                     <td width="70%"><?php echo $row['student_number'];?></td> 
                </tr>  
               <tr>  
                     <td width="30%"><label>Assigned Department</label></td>  
                     <td width="70%"><?php echo $row['assigned_dept'];?></td> 
                <tr>  
                     <td width="30%"><label>Student Name</label></td>  
                     <td width="70%"><?php echo $row['student_name'];?></td>  
                </tr>  
                <tr>  
                     <td width="30%"><label>Course</label></td>  
                     <td width="70%"><?php echo $row['course'];?></td> 
                </tr>  
                <tr>  
                     <td width="30%"><label>Year Level</label></td>  
                     <td width="70%"><?php echo $row['year_level'];?></td> 
                </tr>
                 <tr>  
                     <td width="30%"><label>Contact Number</label></td>  
                     <td width="70%"><?php echo $row['contact_no'];?></td>  
                </tr>
                 <tr>  
                     <td width="30%"><label>Email Address</label></td>  
                     <td width="70%"><?php echo $row['email_add'];?></td> 
                </tr>
                 <tr>  
                     <td width="30%"><label>Vacant Time</label></td>  
                     <td width="70%"><?php echo $row['vacant_time'];?></td> 
                 <tr>  
                     <td width="30%"><label>HK Special</label></td>  
                     <td width="70%"><?php echo $row['hk_special'];?></td>  
                </tr>
                 <tr>  
                     <td width="30%"><label>Remarks</label></td>  
                     <td width="70%"><?php echo $row['Remarks'];?></td> 
                </tr>
                 <tr>  
                     <td width="30%"><label>HK Facilitator</label></td>  
                     <td width="70%"><?php echo $row['hk_faci'];?></td> 
                </tr>
                 <tr>  
                     <td width="30%"><label>Department Office</label></td>  
                     <td width="70%"><?php echo $row['dept_office'];?></td> 
                </tr>
                 <tr>  
                     <td width="30%"><label>Registration</label></td>  
                     <td width="70%"><img src ="<?php echo "storephotohere/". $row['registration'];?>" height="50%" width="100%">
                </tr>
                 <tr>  
                     <td width="30%"><label>Endorsement</label></td>  
                     <td width="70%"><img src ="<?php echo "storephotohere/". $row['endorse'];?>" height="50%" width="100%">
                </tr>
                 <tr>  
                     <td width="30%"><label>COM</label></td>  
                     <td width="70%"><img src ="<?php echo "storephotohere/". $row['com'];?>" height="50%" width="100%">
                </tr>
                 <tr>  
                     <td width="30%"><label>DTR</label></td>  
                     <td width="70%"><img src ="<?php echo "storephotohere/". $row['dtr'];?>" height="50%" width="100%">
                </tr>
                </table></div>
                 <?php }?>
 
javascript php jquery html ajax
1个回答
0
投票

据我所知,我会在这里回答问题。我认为以下几点

© www.soinside.com 2019 - 2024. All rights reserved.