Description:

In this article, I will explain how to redirect to a new page using Jquery.  

Redirecting a web page means, taking user to new location.

To perform client side redirection, use JavaScript and Jquery.

To redirect to a web page or url address using JavaScript,

window.location.href = 'http://www.jqueryjohn.com';

To redirect to a web page or url address using JQuery,

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

In the below program, I will explain redirecting to a web page and web address using Jquery and JavaScript.

Example Program:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#btnRedirectJS').click(function () {
                window.location.href = 'http://www.jqueryjohn.com';
                //window.location.href = 'Session.aspx';
                return false;
            });
            $('#btnRedirectJQ').click(function () {
                var url = 'http://www.jqueryjohn.com';
                //var url = 'Session.aspx';
                $(location).attr('href', url);
                return false;
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnRedirectJS" runat="server" Text="Redirect using Javascript" />
        <asp:Button ID="btnRedirectJQ" runat="server" Text="Redirect using Jquery" />
    </div>
    </form>
</body>
</html>


How to make redirect page using Jquery , Jquery redirect to another page , Redirect webpage using Jquery, Redirect to another page. Redirecting page from one page to another page using Jquery, Page redirection on click using Jquery.

0 comments:

Post a Comment

 
Top