我正在尝试加载“远程”内容,基本上是通过HTTP请求(在同一站点上)发送的信息.返回的内容本身会抛出以下信息:
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">× </button> <h3>Change Your Password</h3> </div> <div class="modal-body"> <form> <fieldset> <label>Your current password</label> <input type="password" placeholder="password"> <label>Confirm current password</label> <input type="text" placeholder="password"> <button type="submit" class="btn">Submit</button> </fieldset> </form> </div> <div class="modal-footer"> <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a> </div>
但是,对于显示远程内容的模式框,我相信我应该已经显示了模态体类:
<div class="modal fade hide" id="ajax"> <div class="modal-body"> <p>body content to be replaced</p> </div> </div>
解决方法
看起来你想用网页填充模态体.您可以使用a标记并使用data-target属性来调用模态:
< a id =“file_attach”data-toggle =“modal”href =“http://fiddle.jshell.net/jhfrench/6K8rD/show/”data-target =“#utility”class =“btn”>模态1< / a>
If a remote url is provided,content will be loaded via jQuery’s load
method and injected into the .modal-body. If you’re using the data
api,you may alternatively use the href tag to specify the remote
source.
有关示例,请参阅http://jsfiddle.net/jhfrench/qv5u5/(有关如何在多个调用链接之间重新使用一个模态的详细信息,请参阅How can I reuse one Bootstrap modal div?).