Pages Navigation Menu

Coding is much easier than you think

Refresh DIV Content Without Reloading Page using jQuery

jQueryAJAX
 
In my previous post, I explained about making AJAX calls to a servlet from a JSP page and updating a part of the JSP page with the response from the Servlet.
 
This article will help you to Refresh DIV Content Without Reloading Page using jQuery with simple html page.
 
demo
 

<HTML>
<HEAD>
<TITLE>Refresh Div without Reloading Page</TITLE>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script>
	$(document).ready(function() {
		setInterval(function() {
			var randomnumber=Math.floor(Math.random()*100)
			$('#show').text('Random Number ==> '+randomnumber);
		}, 2000);
	});
</script>
</HEAD>
<BODY>
<div align="center">
<h3>Refresh DIV Content Without Reloading Page using jQuery</h3>
<br>
Demo by Mohaideen - @ <a href="" target="_blank">SimpleCodeStuffs</a>
<br>
<br>
<div id="show" style="padding:10px;border-radius:9px;border:3px solid #EE371A;width:50%;">
This div will get refreshed for every 2 seconds..! 
</div>
</div>	
  
</BODY>
</HTML>

 
Another must read article

 

About Mohaideen Jamil


I'm a Full stack developer of IT exp in J2EE, AngularJs, MicroServices, Docker, Spring (Boot, MVC, Cloud), Bluemix, DevOps. Follow me on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.

Advertisements
%d bloggers like this: