title: How to add delete function in jquery with php?
body: <p>I am working on one jquery script with codeigniter. i get dynamic data in for loop. i want to add crud operations on it. but My view and Edit is working fine.But dont know how to add delete method on it.</p>
  
  <pre><code>for(var j=0;j&lt;arrayData.length;j++)
      {
            var country = "";
            var color = "";
            action1 = "VIEW";
            action2 = "EDIT";
            action3 = "DELETE";
  
  
              if(arrayData[j].key=="40")
               {
                   country = "UK";                              
                   color = "INDIANRED";
                   check+= '&lt;a class="btn btn-success"  style="background-color : ' + color  + ';" href="&lt;?php echo base_url()?&gt;responsible/uk_pdf/'+arrayData[j].value+'"&gt;'+action1+
                                '&lt;/a&gt; '+
                                  '&lt;a class="btn btn-success"  style="background-color : ' + color  + ';" href="&lt;?php echo base_url()?&gt;responsible/edit_slips_uk/'+arrayData[j].value+'"&gt;'+action2 +
                                '&lt;/a&gt; ' + '&lt;a class="btn btn-success"  data-toggle="modal" style="background-color : ' + color  + ';" href="&lt;?php echo base_url()?&gt;responsible/delete_slips_uk/'+arrayData[j].value+'"&gt;'+action3 +
                                '&lt;/a&gt; | ';                                      
  
               }              
  
      }
  </code></pre>
  
  <p><code>arrayData[j].value</code> in this i am getting my value.<code>responsible/delete_slips_uk</code>  I am calling this method to delete my row.
  Controller:</p>
  
  <pre><code>public function delete_slips_uk()
    {
  
      $this-&gt;load-&gt;model('pay_slips_model');
      $result=$this-&gt;pay_slips_model-&gt;delete_slips_uk($id);        
      if($result==true)
        {
          $this-&gt;session-&gt;set_flashdata('success_msg',"Deleted Successfully");
          redirect('responsible/view_slips_admin_1');
        }
      else
        {
          $this-&gt;session-&gt;set_flashdata('error_msg',"Customer Records Deletion Failed");
          redirect('responsible/view_slips_admin_1');
        }
  
    }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public function delete_slips_uk($id)
                  {
  
                      $this-&gt;db-&gt;where('id', $id);                   
                      $this-&gt;db-&gt;delete('uk_new_salary_slip');
                      return ($this-&gt;db-&gt;affected_rows() != 1 ) ? false:true;
                  }
  </code></pre>
  
  <p>I am stuck on delete function. onclick delete it goes to my method it directly goes to else condition with this message <code>Customer Records Deletion Failed</code>.I am unable to call post my <code>arrayData[j].value</code> from jquery to my controller. please help me with the same. so i can manage to complete my delete operations too.</p>