未找到Codeigniter 404页面未找到您请求的页面

I search for a long times and I finally found this 'search and view' tutorials in google but after I tried to run, It show me '404 page not found'. Is there any mistakes? Please help me and thankyou. I'm really new for this.

this is controllers -> Search.php

<?php 
 function ajaxsearch()
    {

       if(is_null($this->input->get('id')))
        {

        $this->load->view('input');    


        }
        else
        {
        $this->load->model('Bookmodel'); 

        $data['booktable']=$this->Bookmodel->booktable($this->input->get('id')); 

        $this->load->view('output',$data);

        }


    }


this is model -> Bookmodel.php

<?php 

function booktable($search){

        $query = $this
                ->db
                ->select('jantina','bangsa','agama')
                ->from('pesakit')
                ->like('rn',$search)
                ->or_like('name',$search)
                ->get();

        if($query->num_rows()>0)
        {
            return $query->result(); 
        }
        else
        {
            return null;
        }

}


this is views -> input.php

<div class="container">

 <!-- search box container starts  -->

    <div class="search">
        <div class="space"></div>
  <form action="" method="get">

      <div class="row">
       <div class="col-lg-10 col-lg-offset-1">
        <div class="input-group">

            <span class="input-group-addon" >BOOK SEARCH</span>
  <input autocomplete="off" id="search"  type="text" class="form-control input-lg" placeholder="Search Book name or Author " >

        </div>
       </div>
      </div>   
      <div class="space"></div>
  </form>
     </div>  
  <!-- search box container ends  -->


     <div id="txtHint" style="padding-top:50px; text-align:center;" ><b>Book information will be listed here...</b></div>

</div>
<script>
  <script>
$(document).ready(function(){
   $("#search").keyup(function(){
       var str=  $("#search").val();
       if(str == "") {
               $( "#txtHint" ).html("<b>Book information will be listed here...</b>"); 
       }else {
               $.get( "<?php echo base_url();?>home/ajaxsearch?id="+str, function( data ){
                   $( "#txtHint" ).html( data );  
            });
       }
   });  
});  
</script>


this is output Views -> output.php

<?php
    if(!empty($booktable ))  
 { 

      $output = '';
      $outputdata = '';  
      $outputtail ='';

      $output .= '<div class="container">
                   <div class="table-responsive">
                   <table class="table table-bordered">
                    <thead>
                          <tr>
                  <th>Jantina</th>
                              <th>Bangsa</th>
                              <th>Agama</th>
                  </tr>

                   </thead>
                   <tbody>
                   ';

      foreach ($booktable as $objects)    
       {   
           $outputdata .= ' 

                    <tr> 
                    <td >'.$objects->jantina.'</td>
                    <td >'.$objects->bangsa.'</td>
                    <td>'.$objects->agama.'</td>
                    </tr> 

           ';
        //  echo $outputdata; 

          }  

         $outputtail .= ' 
                         </tbody>
                         </table>
                         </div>
                         </div> ';

         echo $output; 
         echo $outputdata; 
         echo $outputtail; 
 }  

 else  
 {  
      echo 'Data Not Found';  
 }

PHP can't find this "<?php echo base_url();?>home/ajaxsearch?id=" and you are calling for Search.php Controller unless if you change the route of your search into home/, if not. Try this:

Replace this:

"<?php echo base_url();?>home/ajaxsearch?id="

With this:

"<?php echo base_url();?>search/ajaxsearch?id="

Updated Answer: for 404 message

For Search.php Controller Replace your ajaxsearch()

with this:

function ajaxsearch()
{   
    $id = $this->input->get('id');
    if(isset($id)){
        $this->load->model('Bookmodel'); 

        $data['booktable']=$this->Bookmodel->booktable($this->input->get('id')); 

        echo json_encode($data);
    }
    echo "error";
}

You are calling the function in wrong format.

Change your url

"<?php echo base_url();?>home/ajaxsearch?id="

to

"<?php echo base_url();?>search/ajaxsearch?id="

Read more about codeigniter url routing from this link