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'

http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit 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");
                form.appendChild(hiddenField);
                document.body.appendChild(form);    // Not entirely sure if this is necessary           
                form.submit();


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:

onclick=window.open(test.html,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');

    
asked Oct 11, 2015 by mannumits1
0 votes
4 views



Related Hot Questions



Government Jobs Opening

'."\n" ; /** This form will be opened in a new window called PayPalPayment. */ echo '
https://www.sandbox.paypal.com/cgi-bin/webscr" 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 '
Local
'."\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 'https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" alt="PayPal - The safer, easier way to pay online!" onclick="serverNotifySelected()">'."\n" ; echo 'https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" 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 11, 2015 by mcasudhir
0 votes

I know this basic method:

1)

 (in any place)

2)


”>
”>
”>

3)


Works!

answered Oct 11, 2015 by atulpariharmca

...