sanders sanders - 21 days ago 5
jQuery Question

jquery fade popupwindow

I am using the popupwindow plugin for jquery to show a form in a popupwindow.
How can I close this window after submitting?
This is the link I am talking about.
I can open a link in a pupup window. But after submitting I want it to open in its parent window.

Answer

You can attach the behavior to your link, in the popup-ed page:

<a href="javascript: self.opener.location = 'http://somewhere.ltd/path/to/dir'; self.close();">
     Let's go Somewhere
</a>

Additionally, I recommend you to use Javascript in an unobtrusive way instead of using the simple line above.

About that "Fade" operation; You can't do such a thing to the OS window using Javascript (no matter what).

Update: Assuming the form with id property theChildForm and using jQuery:

$("#theChildForm").submit(function() {
     // TODO: Some data keeping jobs to be done
     // Pass the url if needed
     self.opener.location = 'http://somewhere.ltd/path/to/dir';
     self.close();
     // ...
    });
Comments