title: how to delete record with codeigniter and jquery?
body: <p>I have working codeigniter controller and view which sucessfully delete record. I would like to do it with ajax - jquery, to avoid reloading the page, and sure enough I will need to prompt the user if he is sure about deleting the record.</p>
  
  <p>Any code snippet would be deeply appreciated, since i don't know where to start:</p>
  
  <p>Here is the code from the controller:</p>
  
  <pre><code>public function deleteUser()
      {
          $this-&gt;load-&gt;model('backOfficeUsersModel');
          $deleteWhat = array(
              'dpage' =&gt; $this-&gt;input-&gt;post('dpage'),
              'rid'   =&gt; $this-&gt;input-&gt;post('rid')
          );
          $this-&gt;backOfficeUsersModel-&gt;delete($deleteWhat['rid']);
          redirect($deleteWhat['dpage']);
      } // end of function deleteUser
  </code></pre>
  
  <p>Here is the view that I have now: (just the php code is presented for the sake of simplicity)</p>
  
  <pre><code>foreach ($users as $key =&gt; $user) {
                              echo form_open('backOfficeUsers/deleteUser');
                              echo form_hidden('dpage', 'backOfficeUsers/displayAllUsers');
                              echo form_hidden('rid', $user['userid']);
                              echo "&lt;tr&gt;";
                              echo "&lt;td&gt;";
  
                              $data = array(
                                  'name' =&gt; 'row_sel',
                                  'id' =&gt; $user['userid'],
                                  'value' =&gt; $user['userid'],
                                  'class' =&gt; 'select_row'
                              );
  
                              echo form_checkbox($data);
  
                              //echo "&lt;input type='checkbox' class='select_row' name='row_sel'&gt;"; 
                              echo "&lt;/td&gt;";
                              echo "&lt;td&gt;" . $user['userid'] . "&lt;/td&gt;";
                              echo "&lt;td&gt;" . $user['firstname'] . " " . $user['lastname'] . "&lt;/td&gt;  ";
                              echo "&lt;td&gt;" . $user['username'] . "&lt;/td&gt;  ";
                              echo "&lt;td&gt;&lt;a href=mailto:" . $user['email'] . "&gt;" . $user['email'] . "&lt;/td&gt;  ";
                              echo "&lt;td style='text-align: center;'&gt;";
                              echo anchor("backOfficeUsers/displayEditUserForm/$user[userid]/", "&lt;i class=splashy-pencil&gt;&lt;/i&gt;", "class=ext_disabled");     
                              echo "&lt;/td&gt;";
                              echo"&lt;td style='text-align: center;'&gt;";
                              $confirm = "class='splashy-remove' style='border:none; width:16px; height:16px;'";
  
                              echo form_submit('submit', '', $confirm);
                              echo"&lt;/td&gt;&lt;/tr&gt;";
  
                              echo form_close();
                          }
  </code></pre>
  
  <p>Any help (code snippet, or link to some example) will be deeply appreciated</p>
  
  <p>Regards,Zoran</p>