0

So I have dynamically generated content from a MySQL database and I pull it with php. To show what I mean look this example.

Goto http://minecraftadmins.net/browse/ See Skin Preview? I want to make it so when you click it, it opens a jQuery popup with content generated from an external source (AJAX). I know how to make a popup. But it doesnt work when dynamic.

Any ideas?

1 Answer 1

1

You could do something like:

<script type="text/javascript">
$(document).ready(function(){
    $('#skin-preview-421').click(function() {
        $.post($('#skin-preview-421').attr('href'), function(resp){
            $("#dlg-skin-preview").html(resp).dialog('open');
        }, 'html');
        return false;
    });
}); 
</script>

<a id="skin-preview-421" class="ex2trigger" href="get_skin_preview.php?id=421">Skin Preview</a>

<div id="dlg-skin-preview" style="display:none;"></div>

Later you could optimize by assigning the clicks in a loop.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.