Open dialog with a result returned from following a url in a popUp built with magnificPopup

333 Views Asked by At

My popup is opened successfully using this jquery code

<html>
<head>
    <link media="all" type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/magnific-popup.css">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js"></script>
</head>
<body>
    <button id="someid">Open popup</button>

<script>
    $('#someid').magnificPopup({
                                          items: {
                                              src:  
                                                    '<div class="white-popup"><br>\
                                                    <a href="**someUrl**">Click</a>',

                                              type: 'inline'
                                          }
                           });  
</script>
</body>
</html>

How to open a dialog with a result returned from following a url ("someUrl" above) in a popUp built with magnificPopup? Tried embeeding javascript function call into 'src' key of magnificPopup, however it didn't work.

1

There are 1 best solutions below

2
On

If you are trying to open a webpage inside the magnific popup, use the type Ajax. Your code just links to a URL.

One other thing you can do is perform an ajax get and open the popup after the response. Make the response result of the ajax response as the data in your popup.