Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to reload the webpage if user make no activity

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 545
    Comment on it

    Hello Reader's! If you are looking for functionality for reloading a web page only when user makes no activity for a while, Then you can use the ajax technology for making the html tag refresh. Lets see the example below:-

     <html>
        <head>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
            <title>Ajax Page</title>
            <script>
            setInterval(function () { autoloadpage(); }, 60000); // it will call the function autoload() after each one minute.
            function autoloadpage() {
                $.ajax({
                    url: "URL of the destination page",
                    type: "POST",
                    success: function(data) {
                        $("div#wrapper").html(data); // here the wrapper is main div
                    }
                });
            }
            </script>
        </head>
        <body>
        <div id="wrapper">
        contents will be changed automatically. 
        </div>
     </body>
     </html>
    

    Here we have target the $("div#wrapper").html(data); html tag. So this part will get refresh

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: