title: Issues getting a html link changed in controller of codeigniter
body: <p>I was using ajax calls. when I click on the edit link it would pop up a modal with all the information. I now want to change it, so that it goes to an edit page instead. The part I need changed is the onclick on the edit link bellow in the code from edit_record to instead call a function in my controller called edit. Any help would be appreciated I spent quit a long time trying different ways and keep getting errors.</p>
  
  <p>Here is the controller function code called ajax_list</p>
  
  <pre><code>public function ajax_list()
  {
      $list = $this-&gt;your_table-&gt;get_datatables();
      $data = array();
      $no = $_POST['start'];
      foreach ($list as $your_table) {
          $no++;
          $row = array();
          $row[] = $your_table-&gt;name;
          $row[] = $your_table-&gt;title;
          $row[] = $your_table-&gt;body;
  
  
          //add html for action
          $row[] = '&lt;a class="btn btn-sm btn-link " href="javascript:void()" title="Edit" onclick="edit_record('."'".$your_table-&gt;id."'".')"&gt;&lt;i class="glyphicon glyphicon-pencil"&gt;&lt;/i&gt; Edit&lt;/a&gt;
                    &lt;a class="btn btn-sm text-warning" href="javascript:void()" title="Hapus" onclick="delete_record('."'".$your_table-&gt;id."'".')"&gt;&lt;i class="glyphicon glyphicon-trash"&gt;&lt;/i&gt; Delete&lt;/a&gt;';
  
          $data[] = $row;
      }
  
      $output = array(
                      "draw" =&gt; $_POST['draw'],
                      "recordsTotal" =&gt; $this-&gt;your_table-&gt;count_all(),
                      "recordsFiltered" =&gt; $this-&gt;your_table-&gt;count_filtered(),
                      "data" =&gt; $data,
              );
      //output to json format
      echo json_encode($output);
  }
  </code></pre>
  
  <p>Here is the code in my your_controller called edit</p>
  
  <pre><code>//loads a single record with the data dispalyed for editing
      function edit($id)
      {
          $data['r']=$this-&gt;your_table-&gt;get_by_id($id);
          $this-&gt;load-&gt;view('pages/edit', $data);
      }
  
  
          //updates data in the database from the edit function
      function save_edit()
      {
          $id=$this-&gt;input-&gt;post('txtid');
          $data=array(
              'name'=&gt;$this-&gt;input-&gt;post('txtname'),
              'title'=&gt;$this-&gt;input-&gt;post('txttitle'),
              'body'=&gt;$this-&gt;input-&gt;post('txtbody'));
  
  
          $this-&gt;db-&gt;where('id', $id);
          $this-&gt;db-&gt;update('your_table', $data);
          redirect('your_controller/index');
      }
  </code></pre>