Question

I have an application that loads an external page and then shows the modal. I'm trying to pass a value from my parent page to the modal window but am having issues.

Parent Window

$('#previewoptin_popupcontrolsettings').click(function (e) {

    $("#popup-content").load('<?php echo $plugins_url;?>);
    $("#bulletPointOne").html($('#wpeocp_popoffercontentbullet1').val());
    $('#popup-content').modal({
        containerCss: {
            backgroundColor: "#fff",
            borderColor: "#000000",
            height: 400,
            padding: 20,
            margin: 20,
            width: 800
        },
        overlayClose: true  ,
        overlayId: 'popup-overlay',
        containerId: 'popup-container'
    });
    return false;
}); 

Modal Window

<div><span class="chkmrkt" id="bulletPointOne"></span></div>

I know I could pass them as query vars, but don't really want to do that.

Thanks!

Was it helpful?

Solution

Jquery load is asynchronous, you must implement a callback function to manipulate loaded content.

$("#popup-content").load('<?php echo $plugins_url;?>', function() {
  // ... do your stuff
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top