title: how to use route for delete record by URL?
body: <p>I want to delete my data on database via JSON, and I'm using codeigniter framework</p>
  
  <p><strong>My <code>route.php</code></strong></p>
  
  <pre><code>$route['api/mahasiswa/delete/(:any)']['DELETE'] = 'MahasiswaController/deleteMahasiswa/$1';
  </code></pre>
  
  <p><strong>My controller</strong></p>
  
  <pre><code>  public function deleteMahasiswa($id)
  
  $this-&gt;Mahasiswa-&gt;deleteMahasiswa($id);
  
  $response = array(
    'Success' =&gt; true,
    'Info' =&gt; 'Data Berhasil di hapus');
  
  $this-&gt;output
    -&gt;set_status_header(200)
    -&gt;set_content_type('application/json', 'utf-8')
    -&gt;set_output(json_encode($response, JSON_PRETTY_PRINT))
    -&gt;_display();
    exit;
  </code></pre>
  
  <p><strong>My model</strong></p>
  
  <pre><code>public function deleteMahasiswa($id)
  
  $val = array(
    'id' =&gt; $id
  );
  $this-&gt;db-&gt;delete('mahasiswa', $val);
  </code></pre>
  
  <p>And I tried to access</p>
  
  <pre><code>http://localhost/json/public/api/mahasiswa/delete/6
  </code></pre>
  
  <p>But it didn't work </p>
  
  <hr>
  
  <p>but my get data is work</p>
  
  <p>my route</p>
  
  <pre><code>$route['api/mahasiswa/get/(:num)/(:num)']['GET'] = 'MahasiswaController/getMahasiswa/$1/$2';
  </code></pre>
  
  <p>my controller</p>
  
  <pre><code>  public function getMahasiswa($page, $size)
  </code></pre>
  
  <p>{</p>
  
  <pre><code>$response = array(
    'content' =&gt; $this-&gt;Mahasiswa-&gt;getMahasiswa(($page - 1) * $size, $size)-&gt;result(),
    'totalPages' =&gt; ceil($this-&gt;Mahasiswa-&gt;getCountMahasiswa() / $size));
  
  $this-&gt;output
    -&gt;set_status_header(200)
    -&gt;set_content_type('application/json', 'utf-8')
    -&gt;set_output(json_encode($response, JSON_PRETTY_PRINT))
    -&gt;_display();
    exit;
  </code></pre>
  
  <p>}</p>
  
  <p>my model</p>
  
  <pre><code>  public function getCountMahasiswa()
  
    return $this-&gt;db-&gt;count_all_results('t_akun', FALSE);
  </code></pre>
  
  <p>public function getMahasiswa($page, $size)</p>
  
  <pre><code>  return $this-&gt;db-&gt;get('t_akun', $size, $page);
  </code></pre>
  
  <p>and i use URL like this</p>
  
  <p><a href="http://localhost/json/public/api/mahasiswa/get/1/5/" rel="nofollow">http://localhost/json/public/api/mahasiswa/get/1/5/</a></p>
  
  <p><a href="http://i.stack.imgur.com/AUrAO.png" rel="nofollow">get data</a></p>