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)