Home · Latest · Trends  /  JavaScript
3

Reload / Refresh Div with jQuery

rated 3 times [  3] [ 0]  / comments: 0 / hits: 1452  / 2 years ago, wed, dec 7, 2016, 12:37:43
Refresh html div content with jQuery
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<script>
$(function() {
    $("a.random").click(function() {
        $(".div1").load(location.href + " .div1");
    });
});
</script>
<a class="random">Click Here</a>
<div class="div1"><?php echo rand(10000,50000); ?></div>
</body>
</html>
More From » JavaScript
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Snippets
Count number of rows in the record set
2 years ago, thu, dec 1, 2016
Getting a MySQL last MySQL id from an ADODB conn
2 years ago, thu, dec 8, 2016
Syntax code highlighting with JavaScript code prettifier for phpBB 3.2
2 years ago, thu, mar 2, 2017
Bootstrap 4 button remove focus outline border
2 years ago, thu, aug 3, 2017
Posted
Micky

Micky

Member since Nov 12, 2016
Total Code Snippets: 5
Total Comments: 2
Location: n/a
Following
User not following anyone yet.