In my coding I am doing jQuery validation which is going successful but when it come to redirect page its not redirecting on given url. when i checked this using firebug it shows every correct field and also the html(given url). i dont know how to redirect the page.
on success i just want to open my admin_login/login page and if validation failed it goes on admin_login/index page.
 <?php include('assets/header.php'); ?> 
<div class="container">
    <h1>Welcome to Admin Login</h1>
    <?if($this->session->flashdata('flashError')):?>
    <p class='flashMsg flashError'> 
        <?= $this->session->flashdata('flashError') ?> </p>
    <?endif?>
    <!-- new line inserted -->
    <form method="post" name="myForm" accept-charset="utf-8"   class="login" id="form" >
        <div class="form-group">
            <div class="col-xs-4">
                <!--<label for="admin">Admin</label>
                <input type="text" name="admin" class="form-control" id="admin" value=""  placeholder="admin name" />-->
                Admin Name: <input type="text" name="admin" id="admin" class="form-control"  value="<?php echo set_value('admin'); ?>"  placeholder="admin name" >
                <?php echo form_error("admin"); ?>
                <p id='p1'></p>
                <br>
                <!--  <label for="password">password</label>
                 <input type="text" name="password" class="form-control" id="password" value=""  placeholder="password" required/>
                -->
                Admin Password: <input type="password" name="password" id="password" class="form-control" value=""  placeholder="password" >
                <?php echo form_error("password"); ?>
                <p id='p2'></p>
                <br>
                <br>
                <input type="button" name="submit" value="submit" id="submit" class="btn btn-primary"  >
            </div>
        </div>
        <div class="error"></div>
    </form> 
</div>
<script>
    $(document).ready(function () {
        $("#submit").click(function () {
            var admin = $("#admin").val();
            var password = $("#password").val();
            $("#returnmessage").empty(); // To empty previous error/success message.
            // Checking for blank fields.
            if (admin == '')
            {
                $('div.error').html("Please Fill Admin Required Fields");
            } else if (password == '')
            {
                $('div.error').html("Please Fill Password Required Fields");
            } else
            {//alert('hello world');
                // Returns successful data submission message when the entered information is stored in database.
                $.ajax({
                    type: "POST",
                    url: "<?php base_url() ?>index.php/admin_login/login",
                    data: {"admin": admin, "password": password},
                    dataType: "json"
                }).done(function (data) {
                    if (data.error != "")
                    {
                        //alert('hello if');
                        $('div.error').html(data.error);
                    } else
                    {
                       // alert('hello else');
                        window.location.href="admin_view";
                    }
                });
            }
        });
    });
</script>
<?php include('assets/footer.php'); ?>
 
     
     
    