Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

can javascript POST data to a new page?

2:13 pm on Jun 26, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 7, 2005
votes: 0

Is it possible for javascript to POST data to a new page when executed in an onChange? I know you can send a new url and include the GET parameters, but I would prefer using POST and I want to know if it is possible.
5:29 pm on June 26, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

<form method="post" action="yourscript" onSubmit="return false;">
<select name="mySelect" onChange="=this.form.submit();">
<option value=...........
<input type="submit" value="For Non-JS support">

Like that?


11:55 pm on July 11, 2005 (gmt 0)

Inactive Member
Account Expired


I have the same question, but the reply doesn't answer it.

I want to have a snippet of javascript on my page that will launch a new window in response to a button click or some other event. That new window should then display a page (from my site, in this case) but I want to pass in some 'parameters' via HTTP POST headers rather than through the URL -- so that some sensitive information is not visible to the user on an address bar.

Is this possible? Need more than a simple window.open, I'd think...

5:10 am on July 12, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 14, 2004
votes: 0

If I understand the original question, I believe the answer is: POST data is sent in a header to the server. It is not available at the client, other than in its raw form.
1:27 pm on July 12, 2005 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Dec 9, 2003
votes: 0

RoboDada, the way to send post data is to submit a form -- javascript can do that with in response to a mouse click or other event. rocknbil's example is exactly what you should use, with one change to POST to a new window:

<form method="post" action="yourscript" onSubmit="return false;" target="_blank">

This line is the javascript that fires the POSTing of the form:

<select name="mySelect" onChange="this.form.submit();">

But it could just as easily by fired by any other onclick, onmouseover, etc.

4:04 pm on July 12, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:July 5, 2005
votes: 0

An easy alternative to passing info through the URL would be to store the information in hidden files in the original page.

Then in your popup, use js to fetch the data from the hidden fields on your original page, like this :



Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members