Newsletter |
Java/Jsp-jQuery : Auto Reload Part Of Webpage In Every 5 Seconds
jQuery » on Sep 10, 2012 { 8 Comments } By Sivateja
Hi friend.., let us see how to reload/refresh any part of webpage in N number of seconds [something like auto refresh Div content of the webpage in a specific time interval], hmm you might seen this type of usage in cricket live score websites 🙂 hope you are well aware of this, even in Facebook/Twitter too. I will show you how to implement this using Java/jsp-jQuery API.
Files Required
- index.jsp
- reload-window.jsp
- jquery-1.4.2.min.js
Directory Structure:
Output Screen:
index.jsp
<html> <head> <script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script> <script type="text/javascript"> var auto = setInterval( function () { $('#score').load('reload-window.jsp').fadeIn("slow"); }, 5000); // refresh every 5000 milliseconds </script> </head> <body> <center> <font face="verdana" size="4px"> Auto Reload Part Of Webpage Every 10 Seconds In Java-Jsp-jQuery </font><br><br> <img src="images/java4s.png"><br><br> <div id="score"></div> </center> </body> </html>
reload-window.jsp
<%@page contentType="text/html" import="java.util.Date;" %> <font face="verdana" size="2"> Current Time :<%= new java.util.Date() %> </font>
Output Video:
You Might Also Like
::. About the Author .:: | ||
Comments
8 Responses to “Java/Jsp-jQuery : Auto Reload Part Of Webpage In Every 5 Seconds”
this script is very well but i want to make something like that for reload some div in the page; can you help me to do that ?
@paul
Currently we are auto refreshing the div with id#score :-), out title is auto refreshing the part of webpage and i took div, to auto reload. Even you can take span or some thing contains id or class.
could u please give me solution on display numbers from access database with time delay in jsp and i need to do some calculation like add/sub
Hey I tried doing this but it. Isn’t getting refreshed every 1 second….and it’s showing me an error near flower braces of function()…saying dat complete the class body by putting).. What to do
Whenever we are changing a data in database then jsp will automatically show the updated data to user.i mean not to refresh or reload continuousaly when we modify data then only needs to be refreshed. How to do this…please help me
Thanks for the tutorial. This is what I was looking for.
Auto Reload Part Of Webpage In Every 5 Seconds is not working in IE8 please reply.
hi
i m making chat application,so i have opened the two browser i want to communicate with each-other.. whenever m sending the msg one browser to another browser it’s not going so plzzz help me how to make communication one browser to another browser (m using spring mvc) ……and how to refreshing the jsp page…