Reputation: 1
I'm using this code to click to reload div. "div1-wrapper" , Can you help edit it. I want it auto reload in 5 second without click. Thanks you.
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function()
{
$('#simple-post').on('click', function() {
var url = '#';
$('.div1-wrapper').load(url + ' .div1');
});
});
</script>
</head>
<body>
<br />
<div class="div1-wrapper">
<div class="div1">
<?php echo rand(10,100); ?>
</div>
</div>
Upvotes: 0
Views: 285
Reputation: 3766
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
(function($){
$(function(){
setInterval(function() {
var url = '#';
$('.div1-wrapper').load(url + ' .div1');
}, 5000);
});
})(jQuery);
</script>
</head>
<body>
<br />
<div class="div1-wrapper">
<div class="div1">
<?php echo rand(10,100); ?>
</div>
</div>
Upvotes: 1