bootstrap 模态框动态加载数据

复制代码
1.页面中添加modal 

<!-- 模态框(Modal) -->
<div class="modal fade" id="showModal" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog" style="width:900px;">
      <div class="modal-content">
//内容动态填充
      </div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
2.数据格式。页面动态生成a 标签
<a data-toggle='modal'   data-target='#showModal' onclick=targetto('"  + row.id + "')>"+ row.title+"</a>";


3.单击事件
 function targetto(id){
             $("#showModal").modal({
                 remote: "showAction.action?id="+id
             });
             }


4.每次隐藏时,清除数据。确保点击时,重新加载
    $("#showModal").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
5.基于bootstrap3.其他版本,请自己Google,如有雷同,纯属巧合,如有需要,欢迎分享。
复制代码

原文:http://blog.csdn.net/shenyingkui/article/details/45693129

posted @   幽冥狂_七  阅读(21633)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
历史上的今天:
2015-12-23 StringBuilder[] 作为数组如何使用
点击右上角即可分享
微信分享提示