Organizational Research By

Surprising Reserch Topic

javascript post on form submit open a new window

javascript post on form submit open a new window  using -'javascript,html,post' shows you how to submit a form that you create via JavaScript via post. Below is my modified code.

var form = document.createElement("form");
            form.setAttribute("method", "post");
            form.setAttribute("action", "test.jsp");

                var hiddenField = document.createElement("input");       
                hiddenField.setAttribute("name", "id");
                hiddenField.setAttribute("value", "bob");
                document.body.appendChild(form);    // Not entirely sure if this is necessary           

What I would like to do is open the results in a new window. I am currentley using something like this to open a page in a new window:,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');

asked Oct 19, 2015 by amit.gupta
0 votes
1 view

Related Hot Questions

Government Jobs Opening


answered Oct 19, 2015 by r3tt
0 votes

I worked on this all day and reading this page helped solve my issue. I was trying to get php to send a new page to the current page AND open a new page and present paypal to the user. Here is what I finally came up with:

/** This is the script that will redraw current screen and submit to paypal. */
echo ''."\n" ;

/** This form will be opened in a new window called PayPalPayment. */
echo '" name="paypal_form" method="post" target="PayPalPayment">'."\n" ;
echo ''."\n" ;
echo ''."\n" ;
echo ''."\n" ;
echo ''."\n" ;
echo '    '."\n";
echo '        '."\n" ;
echo '    '."\n" ;
echo '    '."\n" ;
echo '        '."\n" ;
echo '    '."\n" ;
echo '
'."\n" ; echo ' '.$single_product->short_desc.' $'.$adj_price.' USD'."\n" ; // echo '
'."\n" ; echo ''."\n" ; echo ''."\n" ; /** This form will redraw the current page for approval. */ echo '
'."\n" ; echo ''."\n" ; echo ''."\n" ; echo '
'."\n" ; /** No form here just an input and a button. onClick will handle all the forms */ echo '" border="0" alt="PayPal - The safer, easier way to pay online!" onclick="serverNotifySelected()">'."\n" ; echo '" width="1" height="1">'."\n" ;

The code above is for just one button on the page. When that button is pressed, the screen changes to a pre-approval screen and at the same time another window is opened and gains focus. The new window with focus then get's taken over by PayPal.

answered Oct 19, 2015 by badhwar.rohit