Load PHP Code Into A Dialog

Load PHP Code Into A Dialog


Hi,
I was just wondering if it was possible to load php code into a
dialog. Basically I am trying to call a dialog for each time someone
clicks a member of a list of dynamically generated shopping cart
items. The php that is generating each link looks like this:
<a class="detailsLink" href="<?php echo $_SERVER['PHP_SELF']; ?>?
view=detail&oid=<?php echo $od_id; ?>"><?php echo $od_id; ?></a>
About 10 of these links are generated on a page, and I want each one
to have its own unique dialog pointing to its unique version of
details.php with the proper parameters. Would it look something like
this:
$(function() {
    $(".dialog").dialog({
        bgiframe: true,
        modal: true,
        autoOpen: false,
        buttons: {
            Ok: function() {
                $(this).dialog('close');
            }
        };
    });
    $(".dialog").load("<?php echo $_SERVER['PHP_SELF']; ?>?
view=detail&oid=<?php echo $od_id; ?>",'','');
    $(".detailsLink").click(function(){
        $(".dialog").dialog('open');
    });
});
Also, would I have to keep it in classes like above, or would it still
work with IDs?
Thanks for any help in advance.