title: Codeigniter- Page need to load twice to update
body: <p>I'm trying to insert data to database using ajax, but I need to load the page for me to update the data on my table in my browser. I can see that my pag load after I create or update, but I still need to load my page again to see the result on my table</p>
  
  <p><strong>form.php</strong></p>
  
  <pre><code>&lt;form action="&lt;?php echo site_url($action); ?&gt;" method="post"&gt;
      &lt;div class="ibox-content gbItemHolder divider"&gt;
          &lt;div class="form-group"&gt;
          &lt;label&gt;Disposition Name&lt;/label&gt;
              &lt;input type="text" name="disposition_name" id="disposition_name" placeholder="Disposition Name" class="form-control mBottom2 " value="&lt;?php echo $disposition_name; ?&gt;"&gt;
              &lt;?php echo "&lt;p&gt;".form_error('disposition_name')."&lt;/p&gt;" ?&gt;
           &lt;label&gt;Disposition Code&lt;/label&gt;
              &lt;input type="text" name="disposition_code" id="disposition_code" placeholder="Disposition Code" class="form-control mBottom2 " value="&lt;?php echo $disposition_code; ?&gt;"&gt;&lt;?php echo "&lt;p&gt;".form_error('disposition_code')."&lt;/p&gt;" ?&gt; 
  
              &lt;label&gt;Disposition Email&lt;/label&gt;
              &lt;div id="tags"&gt;
              &lt;input type="text" name="email" id="email" placeholder="Enter Email here" class="form-control mBottom2 " value="&lt;?php echo $email; ?&gt;"&gt;&lt;!-- &lt;?php echo "&lt;p id='email_validation'&gt;".form_error('disposition_code')."&lt;/p&gt;" ?&gt; --&gt;
              &lt;/div&gt;
              &lt;input type="text" id="tenant_id" name="tenant_id" value="&lt;?php echo $tenant_id; ?&gt;" hidden="true"&gt;
              &lt;input type="hidden" id="calldisp_id"  name="calldisp_id" value="&lt;?php echo $calldisp_id; ?&gt;" /&gt;
  
          &lt;/div&gt;
          &lt;div style="margin-top:10px;"&gt;
                  &lt;input type="hidden" name="calldisp_id" value="&lt;?php echo $calldisp_id; ?&gt;"  /&gt; 
                  &lt;button type="submit" class="btn btn-md btn-primary m-t-n-xs" id="triger" value = "&lt;?php echo $button; ?&gt;"&gt;&lt;?php echo $button; ?&gt; Call Disposition&lt;/button&gt; 
  
                  &lt;a href="&lt;?php echo site_url('admin/call_disposition') ?&gt;" class="btn btn-md btn-warning m-t-n-xs"&gt;Cancel&lt;/a&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>js_files_includes.php</strong></p>
  
  <pre><code>$('#triger').click(function(){
                      var btn_value = $('#triger').val();
                      var tenant_id = $('#tenant_id').val();
                      var calldisp_id = $('#calldisp_id').val();
                      var disposition_name = $('#disposition_name').val();
                      var disposition_code = $('#disposition_code').val();
                      var email = $.map($("#tags span"), function(elem, index){
                           return $(elem).text();
                      }); 
                      var myJsonString = JSON.stringify(email);
                      //alert(myJsonString);
                          if(btn_value == 'Create'){
  
                              $.ajax({
                                  url:"&lt;?php echo base_url(); ?&gt;admin/call_disposition/create_email_dispo_dre",
                                  method:"POST",
                                  data:{email:myJsonString,
                                        disposition_name:disposition_name,
                                        disposition_code:disposition_code,
                                        tenant_id:tenant_id},
                                  dataType: 'json',
                                  success:function(data){
                                      toastr.success("Call Disposition Successfully Created");
                                  },
                              });
                          }
                          else if(btn_value == 'Update'){
                              $.ajax({
                                  url:"&lt;?php echo base_url(); ?&gt;admin/call_disposition/update_email_dispo_dre",
                                  method:"POST",
                                  data:{email:myJsonString,
                                        disposition_name:disposition_name,
                                        disposition_code:disposition_code,
                                        calldisp_id:calldisp_id,
                                        tenant_id:tenant_id},
                                  dataType: 'json',
                                  success:function(data){
                                      toastr.success("Call Disposition Successfully Updated");
                                  },
                            });
                          }
  
                  });
  </code></pre>
  
  <p><strong>call_disposition.php</strong></p>
  
  <pre><code>public function create_email_dispo_dre($id){
  
      $this-&gt;_rules();
  
      if ($this-&gt;form_validation-&gt;run() == FALSE) {
          $this-&gt;update($id);
      } else {
      $data = array(
              'tenant_id' =&gt; $this-&gt;input-&gt;post('tenant_id',TRUE),
              'disposition_code' =&gt; $this-&gt;input-&gt;post('disposition_code',TRUE),
              'disposition_name' =&gt; $this-&gt;input-&gt;post('disposition_name',TRUE),
              'email' =&gt; $this-&gt;input-&gt;post('email',TRUE)           
              );
       $this-&gt;calldisp_model-&gt;insert($data);
       redirect('admin/call_disposition/update/'.$id);
  
      }
  
  }
  public function update_email_dispo_dre(){
  
      $data = array(
              'calldisp_id' =&gt; $this-&gt;input-&gt;post('calldisp_id',TRUE),
              'disposition_name' =&gt; $this-&gt;input-&gt;post('disposition_name',TRUE),
              'disposition_code' =&gt; $this-&gt;input-&gt;post('disposition_code',TRUE),
              'email' =&gt; $this-&gt;input-&gt;post('email',TRUE),
              'tenant_id' =&gt; $this-&gt;input-&gt;post('tenant_id',TRUE)
          );
          $this-&gt;calldisp_model-&gt;update($this-&gt;input-&gt;post('calldisp_id', TRUE), $data);
          redirect('admin/call_disposition/update/');
  }
  </code></pre>