【发布时间】:2017-01-05 00:04:49
【问题描述】:
我想要做的是自动更新由 ajax 构建的任何前置 div 的评论计数。所以基本上替换了ajaxed响应div commentprint
success: function(data) {
$.each(data.posts, function(i, response) {
$("#homestatusid").prepend("<div id='commentprint"+response['streamitem_id']+"'>Comments "+response['num']+"</div>")[
}
});
我有一个名为 ajaxcommentcount.php 的页面。这是响应的来源并替换 commentprint。我只是不知道该怎么做。
【问题讨论】:
-
抱歉,我没看到该评论数应该添加到哪里
-
我想替换已经被ajax前置的div。
<div id='commentprint"+response['streamitem_id']+"'>Comments "+response['num']+"</div> -
所以我需要有一些函数在 setInterval 中加载 ajaxcommentcount.php 页面,然后以某种方式替换新插入的 div。
<div id='commentprint"+response['streamitem_id']+"'>Comments "+response['num']+"</div> -
那么这个问题对于这个网站来说太宽泛了,因为现在它是一个为我写点什么类型的问题
-
除非您向我们展示更多代码,因为您展示的代码有些具体且可能不相关