javascript - jquery 标签不是由 $.post 生成的

标签 javascript php jquery html twitter-bootstrap

在我的页面上,我以异步方式加载表格内容:

$.post( "test.php", function( data ) {
     $('#myTableBody').html(data);
     //refresh the content by jQuery 
});

进入以下表体:

<table>
 <thead>
   ...
 </thead>
 <tbody id='myTableBody'>
   <!--No Content before loading it -->
 </tbody>
</table>

test.php包含正常表格格式的表格主体内容,例如 <tr><td></td></tr> ,与 jQuery - 和Twitter-Bootstrap - 弹出窗口或对话框的标签。 (这些标签的代码不是必需的,因为我认为应该有一种方法可以通过一个通用标签刷新 jQuery?)

在静态页面上加载那些 jQuery -标签被替换为 csshtml -当 device-ready 时由 jQuery 定义的标签事件出现。

但现在我的问题是,怎么说jQuery/ js/ twitter-bootstrap ,有新内容。如何触发重新替换?

最佳答案

使用ready() ,所以 DOM 已经准备好进行操作了,

jQuery(function($){
    $.post( "test.php", function( data ) {
         $('#myTableBody').html(data);
         //refresh the content by jQuery 
    });
});

关于javascript - jquery 标签不是由 $.post 生成的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22144396/

相关文章:

javascript - 使复选框功能的整行可单击,而无需停用复选框本身

javascript - jQuery slick(轮播)插件不起作用

php - MySQL 合并多个表的查询结果

php - 在 XAMPP 上使用 PHP 邮件功能

php - 保持一个php脚本一直运行

javascript - 从被点击的元素image src中放入image src并更新数据

javascript - 循环根据键获取对象的值

javascript - 获取 <a> AngularJS 中选定的值

javascript - Jquery UI 选项卡-根据输入字段值使用下一个/上一个按钮推进选项卡

javascript - URL 更改后更改按钮的状态