jquery - 如何在 ajax 回调后重新加载 div,而该 div 中没有特定类
问题描述
是否可以在 ajax 调用后重新加载 div,而该 div 中没有特定类?我有一个带有类的 div comments
,我想在 ajax 调用后重新加载它。类media
和modal
由 foreach 循环生成。
<div class="comments">
<div class="media">
some content here
</div>
<div class="modal">
content of modal
</div>
<div class="media">
some content here
</div>
<div class="modal">
content of modal
</div>
<div class="media">
some content here
</div>
<div class="modal">
content of modal
</div>
</div>
我的阿贾克斯:
success: function(data) {
$('.result').html(data);
$(".comments").load(" .comments > *"); // reload div comments
},
所以我正在寻找类似的东西:
$(".comments").load(" .comments > *"); // reload div comments except the classes .modal in that div
解决方案
https://www.quora.com/How-can-we-refresh-a-DIV-without-reloading-the-whole-page 或者我只是复制这个
$("#divToReload_WithDAta").load(location.href + " #divToReload_WithDAta");
推荐阅读
- c - 如何确定我的服务器正在使用哪个 asm
- git - 如何在 Yocto 配方中指定 git 分支
- html - 如何在 CSS 中为根元素和子元素应用样式
- azure - 在 Azure Functions Http 触发器上设置 UTF-8 编码
- grep - grep [az] 和 grep '[az]' 有什么区别?
- python - Pygame:精灵只绘制三个对象中的最后一个
- amazon-web-services - 是什么导致 AWS 中国托管站点中的 ERR_SSL_PROTOCOL_ERROR?
- flutter - 如何控制来自提供者的对话?
- javascript - 我无法让光谱颜色选择器工作。我错过了什么?
- php - CURL PHP 爬虫返回访问被拒绝错误