Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > simulate a POST ACTION with javascript

Reply
Thread Tools

simulate a POST ACTION with javascript

 
 
q2005
Guest
Posts: n/a
 
      10-28-2004
Hi, all

Is that possible I can do
window.open("http://xserver1/app/typ/test/tesServer.php?aaa=111&bbb=222&ccc=
333","","") to simulate a POST ACTION with a form rather than a GET ACTION?

Jack


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      10-28-2004
q2005 wrote on 28 okt 2004 in comp.lang.javascript:

> Is that possible I can do
> window.open("http://xserver1/app/typ/test/tesServer.php?aaa=111&bbb=222
> &ccc= 333","","") to simulate a POST ACTION with a form rather than a
> GET ACTION?
>


<form id=f method=post target="_blank"
action="http://xserver1/app/typ/test/tesServer.php">
<input type=hidden name=aaa value="111"
<input type=hidden name=bbb value="222"
<input type=hidden name=ccc value="333"
</form>

<script ...>
document.getElementById("f").submit()
....

not tested

==========

Or you do the same targetting
a previously window.open()ed and named window.

==========

Or you can define the whole form in DOM

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

 
Reply With Quote
 
 
 
 
Fox
Guest
Posts: n/a
 
      10-28-2004
q2005 wrote:
> Hi, all
>
> Is that possible I can do
> window.open("http://xserver1/app/typ/test/tesServer.php?aaa=111&bbb=222&ccc=
> 333","","") to simulate a POST ACTION with a form rather than a GET ACTION?
>
> Jack
>
>


function
handleSubmit(formRef)
{
window.open("","formTargetWindow");

formRef.target = "formTargetWindow";
formRef.method = "post";
formRef.action = "http://xserver1/app/typ/test/tesServer.php";

formRef.submit();

return false;
}

There's no reason why you need javascript for this (unless you need to
customize the window):

<form action = "formURL.xxx" method=post target=formTargetWindow>

(just give the window any name you want and post the form to it -- it's
probably a "safer" popup because I don't believe these are suppressed by
popup blockers [could be wrong tho])


js demo in action:
http://site-creations.com/demo/postform2win.htm

all the action script does is var_dump($_POST) wrapped in xmp tags.

Fox
************
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      10-28-2004
On Thu, 28 Oct 2004 17:29:05 +1000, q2005 <(E-Mail Removed)> wrote:

> Is that possible I can [use a query string] to simulate a POST ACTION
> with a form rather than a GET ACTION?


Generally, no. If a server-side document expects POST data, it will
generally use methods that obtain *only* POST data.

The only[1] way to submit POST data is via a form.

Mike


[1] Certain hosts may provide other ways, but you can't rely on them on
the Web.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to simulate POST Form on server? nospam ASP .Net 1 10-13-2007 03:01 AM
Simulate Form Post on Server Side BarryX ASP .Net 1 09-26-2007 10:48 AM
Simulate post at webpage dast C++ 2 09-15-2005 09:59 AM
Simulate post method in a servlet delph Java 3 05-13-2005 02:48 PM
How to simulate a form post? Al Cadalzo ASP .Net 4 02-17-2004 05:11 PM



Advertisments