How to Refresh DIV Content Without Reloading Page using jQuery?
In my previous example I’ve explained you, how to refresh data on JSP page coming from Spring MVC Controller and refresh using JQuery..
This article will help you to understand the power of jQuery (library of JavaScript functions) with simple html page.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<HTML>
<HEAD>
<TITLE>Crunchify - Refresh Div without Reloading Page</TITLE>
<style type="text/css">
body {
background-image:
url('http://cdn3.crunchify.com/wp-content/uploads/2013/03/Crunchify.bg_.300.png');
}
</style>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
$(document).ready(
function() {
setInterval(function() {
var randomnumber = Math.floor(Math.random() * 100);
$('#show').text(
'I am getting refreshed every 3 seconds..! Random Number ==> '
+ randomnumber);
}, 3000);
});
</script>
</HEAD>
<BODY>
<br>
<br>
<div id="show" align="center"></div>
<div align="center">
<p>
by <a href="http://crunchify.com">Crunchify.com</a>
</p>
</div>
</BODY>
</HTML>
|
0 comments :