我有一个正在滚动滚动加载的帖子或新闻提要数据。用户可以在该帖子或新闻源上发表评论。发表评论后,该newfeed的特定评论框应重新加载或刷新。
$(document).ready(function() {
$(document).on('submit','[id^="comment-form-"]',function(){
event.preventDefault();
alert(1);
var formId = this.id;
$.ajax({
type: "POST",url: link+'/new-comment',data: $(this).serializeArray(),success: function(data){
clearError();
if(data.success=='success'){
var r = data.post_unique_id;
//I would like to update this two div.
$('#post_id_count_'+r+'').load(location.href + ' #post_id_count_'+r+'');
$('#post_id_comment_'+r+'').load(location.href + ' #post_id_comment_'+r+'');
$('#comment-form-'+r+'').trigger('reset');
} else {
$('#comment_enter_'+r+'').addClass('err-border');
}
},error: function(xhr,status,error) {
errorAlert("Error!","Oops ! something went wrong");
},});
});
});
如何重新加载或刷新新添加的数据?