title: Page Redirect using jquery
body: <p>i am using jquery for login it is working fine but i have to redirect the login page on index.php page if success==1 else it will show the error. But it does not redirect on index page and remains on same login page.Can anyone please help me.This is my code</p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-1.7.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() { 
              $('#form_login').submit(function() { 
  
                  var uname= $('#username').val(); alert(uname);
                  var password=$('#password').val(); alert(password);
                  $.ajax({
                      type: "POST",
                      url: "http://localhost/shop/admin/match_login.php",
                      data: {uname: uname, password:password},
                      success:function(data){
                      if(data==1){ alert("right");
                      var url='http://localhost/shop/admin/index.php';
                      $(location).attr('href',url);
  
                      }else{ alert("wrong");
                      $('#login-msg').html("Wrong User Name/Password");
  
                      }
  
  
                      } //call function after success
                  });
                      return false;
  
              });
          }); 
  &lt;/script&gt;
  
  
  
  
  session_start();
  require_once("../utils/config.php");
  require_once("../utils/functions.php");
  require_once("../utils/dbClass.php");
  require_once("../utils/database.php");
   $objNEWDB = new NEWMySQL;
   $host= $_SERVER['HTTP_HOST'];
   $url=$_SERVER['SCRIPT_URI'];
   $hostnew=substr($url,0,-16);
   $user_name= $_POST['uname'];
   $password= $_POST['password']; 
   $SQL = "Select * from admin where UserName ='".$user_name."' and Password='".$password."'";
   $rsUser = $objNEWDB-&gt;select($SQL); //print_r($rsUser);
   //$res=mysql_fetch_array($rsUser); 
   if(sizeof($rsUser)==1 &amp;&amp; $rsUser[0]['Status']=='1')
   {
      $_SESSION["session_admID"] = $rsUser[0]['AdminID']; 
  
   }
      echo $size= sizeof($rsUser);
  </code></pre>