Wed, April 14, 2021
 
https://devcodepro.comdevcodepro
Home · Latest · Trends  /  JavaScript
8

Reload / Refresh Div with jQuery

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>
rated 8 times (8) (0)
comments: 0 / hits: 4465  / 4 years ago, wed, dec 7, 16, 12:37:43
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
Posted
Micky
Member since Nov 12, 2016
Total Code Snippets: 5
Total Comments: 2
Location: n/a
Micky snippets
4 years ago, thu, dec 1, 16, 6:27:26
comments: 0 / hits: 3542
PHP
4 years ago, thu, dec 8, 16, 6:21:29
comments: 1 / hits: 9157
PHP
4 years ago, thu, mar 2, 17, 6:35:12
comments: 0 / hits: 8526
4 years ago, thu, aug 3, 17, 2:59:59
comments: 0 / hits: 12293
CSS