title: Delete record with out page refresh in codeigniter is not working
body: <p>Hi all i am trying to delete my  record from datatable with out page refresh in codeigniter i have used ajax i don't know where i have done mistake its not deleting the record</p>
  
  <p>Below  is the my view:</p>
  
  <pre><code>    &lt;tbody&gt;
                          &lt;?php
                          if (!empty($employees)) {
                              foreach ($employees as $emp) {
                                   ?&gt;
  
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;?php echo $emp-&gt;emp_name; ?&gt;&lt;/td&gt;
                                      &lt;td&gt;&lt;?php echo $emp-&gt;salary; ?&gt;&lt;/td&gt;
                                      &lt;td class='text-center'&gt;
                                      &lt;button type="submit" class="btn btn-info btn-xs confirmation" name="login"&gt;&lt;i class='fas fa-edit'&gt;&lt;/i&gt;&lt;/button&gt;
                                      &lt;/td&gt;
  
                                      &lt;td class='text-center'&gt;
                                       &lt;button type="submit"  onClick="return ConfirmDelete()" class="btn btn-danger btn-xs confirmation empdelete" id="&lt;?php echo $emp-&gt;id;?&gt;"&gt;&lt;i class='fas fa-times'&gt;&lt;/i&gt;&lt;/button&gt;
                                       &lt;/td&gt;
                                 &lt;/tr&gt;
  
                                  &lt;?php
                              }
                          }
                          ?&gt;
                      &lt;/tbody&gt;
      &lt;script&gt;
  $(document).ready(function(){
  $(".empdelete").click(function(e){
      alert();
     e.preventDefault(); 
      $.ajax({
        alert();
        type: "POST",
        url: "&lt;?=site_url('Employee/delete');?&gt;",
        cache: false,
        data: {id:$(this).attr("id")}, // since, you need to delete post of particular id
        success: function(data) {
           if (data){
              alert("Success");
           } else {
               alert("ERROR");
           }
           return false;
  
         }
     });
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the my controller:</p>
  
  <pre><code>  function delete()  
    {
      $id = $this-&gt;input-&gt;post('id'); // get the post data
      $empdelete=$this-&gt;Emp_model-&gt;delete($id);
      if($empdelete){
          echo true;
      } else {
          echo false;
      }
   }
  </code></pre>
  
  <p>Here is my model's method delete:</p>
  
  <pre><code>function delete($id)
  { 
  $sql  = "DELETE FROM employees WHERE id=?";
  return $this-&gt;db-&gt;query($sql,array($id));
  </code></pre>
  
  <p>}</p>
  
  <p>Can any one help me how can i do that with out page refresh i want to delete my record.</p>
  
  <p>Thanks in advance.</p>