Powered by Blogger.

Thursday, February 27, 2014

Redirect to different page using jQuery in Asp.Net



In this post we will discuss how to redirect to a different page using jQuery. Also you can check out my previous posts on:

- stored procedure to update record in sql server 2008

- Anonymous Types in C#.Net

- GAC in Asp.Net

We can redirect to a different page by using window.location.replace("");

Below is the jQuery code, once you will run the page it will redirect to http://www.aspdotnethelp.com page.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default14.aspx.cs" Inherits="Default14" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Redirect to different page using jQuery</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            window.location.replace("http://www.aspdotnethelp.com");
        });
        </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
</body>
</html>



0 comments

Post a Comment