How to reload or refresh page in JQuery using different ways for ASP.NET applications


Way 1: Page refresh using JQuery for every 3 seconds.

 <script type="text/javascript">
 function Refresh() { 
      location.reload();
 };
$(document).ready(function() {
    setTimeout("Refresh()", 3000); //3 sec.
});
 </script>





Way 2: page refresh on button click using JQuery.

        <script type="text/javascript">
            $(document).ready(function() {
                $("#btnRefresh").click(function() {
                    location.reload();
                });
            });
        </script>

<body>
    <form id="form1" runat="server">
    <div>
        <input id="btnRefresh" type="button" value="Refresh here" />
    </div>
    </form>
</body>

Way 3: Page refresh using javascript code.

<script type="text/javascript">
    window.onload = setupRefresh;

    function setupRefresh() {
      setTimeout("PageRefresh();", 5000); // refresh on every 5 secs.
    }
    function PageRefresh() {
       window.location = location.href;
    }
  </script>

Way 4: add this meta tag in the <head> tag

<meta http-equiv="refresh" content="5000">





If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar