admin管理员组文章数量:1406914
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.
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.
Share Improve this question asked Mar 1, 2011 at 18:03 Codex73Codex73 5,77613 gold badges58 silver badges77 bronze badges 1- You could use jquery's $.ajax methods, then on successful postback change the style of the surrounded div/span to reflect the change. – dmackerman Commented Mar 1, 2011 at 18:04
1 Answer
Reset to default 3Set 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. :)
本文标签: ajaxJavascript AutoRefresh Class ElementsStack Overflow
版权声明:本文标题:ajax - Javascript Auto-Refresh Class Elements - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744990141a2636333.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论