自举3 - 如何通过AJAX加载模式的主体内容? [英] Bootstrap 3 - How to load content in modal body via AJAX?

查看:175
本文介绍了自举3 - 如何通过AJAX加载模式的主体内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你可以在这里看到 的,我有一个按钮,启动一个模态。设置一个href URL的按钮,这个网址被自动装入模式通过引导3。 事实是这样的页面加载到模态根(如引导3文档情态动词的用法)。我想要将其加载到模态体来代替。

As you can see here, I have a button that launches a modal. Setting an href url for the button this url is automatically loaded into modal by Bootstrap 3. The fact is this page is loaded into modal root (as said in the bootstrap 3 documentation for modals usage). I want to load it into the modal-body instead.

有没有办法通过属性(没有JavaScript)的办呢?或者,什么是最自动化的方式来做到这一点?

Is there a way to do it via attributes (not javascript)? Or what is the most automatic way to do it?

P.S。记得在自举2将内容物在体内加载,不是根

P.S. I remember in Bootstrap 2 the content was loaded in the body, not the root.

推荐答案

这太回答的。

看起来唯一的办法是提供整体模态结构的Ajax响应。

It looks like the only way is to provide the whole modal structure with your ajax response.

正如你可以检查从引导源$ C ​​$ C ,负载功能被绑定到根元素。

As you can check from the bootstrap source code, the load function is binded to the root element.

如果你不能修改Ajax响应,一个简单的解决方法可能是 $(..)模式(..)插件上的一个显式调用你的身体元素,即使它可能会破坏根元素的显示/隐藏功能。

In case you can't modify the ajax response, a simple workaround could be an explicit call of the $(..).modal(..) plugin on your body element, even though it will probably break the show/hide functions of the root element.

这篇关于自举3 - 如何通过AJAX加载模式的主体内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆