使用jquery重定向页面

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

<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript">
$(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;

            });
        }); 
</script>




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->select($SQL); //print_r($rsUser);
 //$res=mysql_fetch_array($rsUser); 
 if(sizeof($rsUser)==1 && $rsUser[0]['Status']=='1')
 {
    $_SESSION["session_admID"] = $rsUser[0]['AdminID']; 

 }
    echo $size= sizeof($rsUser);

try

document.location = url;.

or

document.location.href = url;

You can use simply window.location = "http://localhost/shop/admin/index.php";

// similar behavior as an HTTP redirect
window.location.replace("http://localhost/shop/admin/index.php");

// similar behavior as clicking on a link
window.location.href = "http://localhost/shop/admin/index.php";

change

$(location).attr('href',url);

to

location = url

You can try

if(data==1) { window.location = "Page Url"; }

OR

if(data==1) {window.location.href = "Page Url"; }

Also check whether the if loop is satisfied or not