简体   繁体   English

在bootstrap模式框中加载外部页面

[英]load external page in bootstrap modal box

I have a link like this 我有这样的链接

echo "<a href=\"profile.php?name=".$row['name']."\">".$profile."</a>";

And I have another page 我有另一页

<?php
    $profile = $_GET['name'];
    echo $profile;
?>

Now what I want is when user click on that link bootstrap modal box will open that another page. 现在我想要的是当用户点击该链接bootstrap模式框将打开另一个页面。 How can I do that? 我怎样才能做到这一点? Please help! 请帮忙!

尝试在模态框中使用iframe,并在iframe src中传递您的网址。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<a id="testing" href="http://fb.com/">Hye</a>

<iframe id="frame" src=""></iframe>
<script>
$(document).ready(function(){
    $("#testing").click(function(e){
        e.preventDefault()
        var link = $("#testing").attr("href")
        $("#frame").attr("src",link);

    })

})
</script>

This will change link on click on a tag. 这将在点击标签时更改链接。 But still you can check bootstrap js for opening modal :) 但你仍然可以检查bootstrap js打开模态:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM