views:

30

answers:

2

I need to open the login.aspx page in a dialog box when the user clicks the 'login' link. I've looked at jQuery UI Dialog, but it looks like it can't open whole pages from a given URL?

Do you guys have any tips to what I can use?

+1  A: 

Use an <iframe>.

U-D13
+3  A: 

You can just create an <iframe> and .dialog() it to get what you're after, short a simple. Elijah Manor has a full post with code on how to do this.

Here's a quick version:

$('<iframe src="login.aspx" />').dialog({
   title: 'Login',
   width: 600,
   height: 400,
   modal: true,
}).width(570).height(370); //give it a bit of padding
Nick Craver
Thanks, this worked great. Would you by any change know how I automatically could close the dialogue box after user was logged in? Since it's IFrame content, I probably cant close the Dialog window from that page?
Steven
@Steven - Give the `<iframe>` an ID, like `id="LoginFrame"` then in the child page you can do `window.parent.$('#LoginFrame').dialog('destroy').remove()` or just `.dialog('close')` if you don't want to remove it.
Nick Craver