views:

130

answers:

1

A popup window is opened using window.popup Is it possible send post data to the popup page? I am working in tomcat + jsp

+2  A: 

You can use the target attribute of <form> to POST data to a popup. If you don't need to open the window explicitly using window.open, you can simply use an arbitrary window name as your target and the browser should POST the data to a new window. Whether a new popup opens or not depends on your browser. If you need to explicitly open the popup with window.open, I think you can still target that window with the target attribute once the popup is open.

var win = window.open("placeholder.htm", "mypopup"); // optional step

<form action="doit.jsp" method="post" target="mypopup">
Ates Goral
Excellent! Is it possible to control the windows size of the popup thru target option?
Madhu
No, it's not possible to do that through target. But you could post the desired dimensions to your popup and then resize (with JS) the window based on those parameters.
Ates Goral
the parameter value can easily be changed during a post, if anyone wants to do it. see tamperData plugin for firefox
mkoryak