title: Data not inserting into the database codeigniter
body: <p>I tried in all possible ways to insert the data into the database but i did not get any kind of output 
  This is my controller pages.php</p>
  
  <pre><code>&lt;?php
  
  class pages extends CI_Controller {
  
      function view($page = 'index') {
  
          $this-&gt;load-&gt;view('pages/index');
  
          function insert_data() {
              $this-&gt;load-&gt;model('contact_model');
              $this-&gt;contact_model-&gt;insert_entry();
          }
  
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>this is my view view/pages/index.php</p>
  
  <pre><code>&lt;form id="submit"&gt;
  
      name &lt;input  type="text" id="name" &gt;    
  
      email&lt;input type="email" id="email"&gt;
  
  
      message&lt;textarea id="message"&gt;&lt;/textarea&gt;              
  
      &lt;button type="button"  id="submit1"&gt;Send&lt;/button&gt;
      &lt;a id="ack"&gt;&lt;/a&gt;         
  &lt;/form&gt;
  </code></pre>
  
  <p>this is my model models/contact_model</p>
  
  <pre><code>&lt;?php
  
  class contact_model extends CI_Model {
  
      function insert_entry() {
          $data = array(
              'name' =&gt; 'name',
              'email' =&gt; 'email',
              'message' =&gt; 'message');
  
          $this-&gt;db-&gt;insert('contactus', $data);
      }
  ?&gt;
  </code></pre>
  
  <p>this is my custom.js file</p>
  
  <pre><code>$.ajax({
      url: "&lt;?php echo site_url();?&gt;/pages/insert_data",
      type: 'POST',
      data: {"name": $("#name").val(), "email": $("#email").val(), "message": $("#message").val()},
      success: function(data) {
          $("div#ack").html(data);
      }
  });
  </code></pre>