php - JQuery ajax返回没有类的新html
问题描述
我有这样的 ajax 过滤项目的代码
type: 'POST',
dataType: 'HTML',
url: somefile.ajax_url,
data: data_vals + '&action=content&arg=' + arg,
success: function (response) {
jQuery('#content').html(response);
它返回新的 html 代码,但删除了使用 jQuery 添加的类:
Query(document).on('click','.filter-toggle', function () {
jQuery(this).toggleClass("active").next().slideToggle();
});
过滤器 html 代码在返回的新 html 代码中,因此在返回新 html 过滤器后没有活动类并且它被关闭。当它返回新的 html 时,如何防止剥离类“活动”?
解决方案
推荐阅读
- android - 从 android 中的同一个活动启动一个新的活动实例
- android - 为什么删除 gradle 中的 rootProject.buildDir 任务删除了模块中的构建目录
- json - 将数据从 JSON 文件加载到 html/ 控制台
- java - java中的封闭变量是什么?
- bash - Bash 脚本接受有效数字格式的变量
- angular - 带有防护的Angular 5单元测试路线
- python - 使用 kivy 复选框进行事件处理
- eclipse - 如何在 Eclipse 中完全禁用 SVN?
- angular - 离子onclick滚动到页面底部不起作用
- shopify - 任何人都可以详细说明 Shopify 默认的 _st js 对象吗?