title: redirect in codeigniter using ajax function
body: <p>this is my controller function </p>
  
  <pre><code>    public function verifyUser()    
     {
          $userName =  $_POST['email'];
          $userPassword =  $_POST['password'];
          $var=array('email'=&gt;$userName,'password'=&gt;$userPassword);
          $check=$this-&gt;mymodel-&gt;login_validation($var);
  
  
          //$status = array("STATUS"=&gt;"false");
          if(count($check))
          {
              redirect('main/valid_login');
  
          }
          else
          {
          echo "&lt;div style='border:1px solid red;font-size: 11px;margin:0 auto !important;'&gt;Could't Authorize to the system! Try again with valid credentials.&lt;/div&gt;" ;
          }   
      }
  </code></pre>
  
  <p>this is my ajax function </p>
  
  <pre><code>    &lt;script&gt;
      function makeAjaxCall(){
      $.ajax({
      type: "post",
      url: "&lt;?php echo site_url('main/verifyUser');?&gt;",
      cache: false,               
      data: $('#userForm').serialize(),
       success:function(msg)
      {
          $('#show_id').html(msg);
      }
      });
     }
     &lt;/script&gt;
  </code></pre>
  
  <p>this is my form</p>
  
  <pre><code> &lt;form name="userForm" id="userForm" action=""&gt;
      &lt;div id="show_id"&gt;&lt;/div&gt;
              &lt;fieldset&gt;
  
                  &lt;p&gt;&lt;label for="email"&gt;E-mail address&lt;/label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;input type="email" id="email" placeholder="enter your email id" name="email"&gt;&lt;/p&gt; &lt;!-- JS because of IE support; better: placeholder="mail@address.com" --&gt;
  
                  &lt;p&gt;&lt;label for="password"&gt;Password&lt;/label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;input type="password" id="password" placeholder="*******" name="password" style="width: 328px;"&gt;&lt;/p&gt; &lt;!-- JS because of IE support; better: placeholder="password" --&gt;
  
                  &lt;p&gt;&lt;input type="button" value="Sign In" onclick="javascript:makeAjaxCall();"&gt;&lt;/p&gt;
  
              &lt;/fieldset&gt;
  
          &lt;/form&gt;
  </code></pre>
  
  <p>everything is working fine,but when i entered the valid username and password,its not redirecting to any page,so please help me on this</p>