drpelz
drpelz

Reputation: 811

load page in colorbox

I'd like to know how do you load a .php file into a modal popup made with color box (colorbox is a jquery plugin so you can make modal-dialog popups)?

This is what I want to load

<?php include './includes/misc/misc.inc.php';?>

into this:

<div id="cboxLoadedContent"></div>

Any ideas?

My code for the modal popup looks like this:

$(document).ready(function(){
    $(".register_link").colorbox({
        initialWidth:'896',
        initialHeight:'450',
        innerWidth:'896',
        innerHeight:'450',
        fixed:true,
        scrolling:false,
        transition:'none',
        onOpen: function(){
            $("#colorbox").css("opacity", 0);
        },
        onComplete: function(){
            $("#cboxLoadedContent").appendTo("#cboxContent");

            var title = 'Register';
            $('#cboxTitle').text(title);
            $("#colorbox").animate({"opacity": 1});
        }
    });

Upvotes: 2

Views: 734

Answers (1)

Philippe Boissonneault
Philippe Boissonneault

Reputation: 3949

Wherever your register_link url points to, add the $_GET params with something like http_build_query or implode('&', $_GET)

<?php
$my_url = '[url to register_link]'.'?'.http_build_query($_GET);
?>
<a href="<?php echo $my_url; ?>" class="register_link">my text</a>

Then in your register_link script you can include the file you need wherever you need:

<?php include './includes/misc/misc.inc.php'; ?>

Upvotes: 1

Related Questions