Creating iframe Modal with Javascript

Hi, I have no problem to create iframe modal with hyperlink (see the code below):

User Group

new Control.Modal($('ugm'),{ afterOpen: function() {ugm_client_registerUpdateFunction(null, "ugm");}, iframe: true, overlayCloseOnClick: false, width: 760, height: 480 });

However, I am not sure how to create the same modal with Javascript. Since the content has to be loaded from server, I try to do Ajax modal like

function openModal(url) { ? m = new Control.Modal(false,{? contents: function(){? new Ajax.Request(url,{? onComplete: function(request){? this.update(request.responseText);? }.bind(this)? });? return 'loading';? }?, afterOpen: function() {ugm_client_registerUpdateFunction(null, "ugm");}, iframe: true, overlayCloseOnClick: false, width: 760, height: 480 }); ?m.open(); }

User Group

But it does not quite work. Is there another way to create the modal with/withou Ajax in this scenario?

Thanks,

Laiwu

Posted May 17th, 2007 at 4:43pm by lluo

Login or Register to Post