Quantcast
Channel: jquery – Crunchify
Viewing all articles
Browse latest Browse all 7

How to Refresh DIV Content Without Reloading Page using jQuery?

$
0
0

Crunchify - JQuery JSON Example

In my previous example I’ve explained you, how to refresh data on JSP page coming from Spring MVC Controller and refresh using JQuery.. You can take a look at it here.

This article will help you to understand the power of jQuery (library of JavaScript functions) with simple html page.

Demo

<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>

List of all Java, jQuery, AJAX, Spring MVC Examples.

Have a suggestion or anything to add to this article? Chime in and share as a comment OR post it in forum.

The post How to Refresh DIV Content Without Reloading Page using jQuery? appeared first on Crunchify.
Author: App Shah

Viewing all articles
Browse latest Browse all 7

Trending Articles