[英]How to load an external PHP file inside modal pop-up?
场景 - 我计划加载一个外部 PHP 文件,该文件在 jquery 按钮单击事件的模态弹出窗口中包含一个更新表单。
我能够在单击按钮时加载弹出窗口,但找不到在模式弹出窗口中加载外部文件的清晰而简短的解决方案。 为了举例,让我们假设编辑表单只有电子邮件文本字段。
NOTE- I am trying to load file locally
JS 小提琴 - jsfiddle.net/1aeur58f/1
我想在弹出窗口的正文中显示文件内容,如 JsFiddle 所示
因此,我认为您根本不必加载外部源。 如果你想在页面中包含内容,我认为你应该像我下面做的那样做。
<?php
$user = $client->get('account');
?>
<!-- Make the model show up -->
<!-- Pretend this is the form -->
<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?= 'Some kind of title' ?></h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.