Problem:
Values constantly change on db. Need to auto-reload 开发者_如何学编程certain elements values without reloading all page. Very similar to collective bidding pages as attached image.
A simple page Dashboard type with three columns of grid organized data.
How can I effectively reload (AJAX CALL) certain class types, content?
Since these column values change as time goes from db, they have to auto refresh on time interval.
Code Sample:
<div class="autovalue">26</div>
<div class="autovalue">20</div>
<div class="autovalue">96</div>
Maybe Jquery has a method.
Set an interval function, i did this example using jQuery.
var intervalID = setInterval(function(){
$('.refreshClass').each(function(){
$(this).load(this.href);
})
}, 900);
In my example <a href="url-to-get.php" class="refresh"></a>
will request the href attribute every 900ms and update the innerHtml.
For a better performance you can cache your selectors and use id instead of classes. :)
精彩评论