473,732 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simulate a POST ACTION with javascript

Hi, all

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

Jack
Jul 23 '05 #1
3 8087
q2005 wrote on 28 okt 2004 in comp.lang.javas cript:
Is that possible I can do
window.open("ht tp://xserver1/app/typ/test/tesServer.php?a aa=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.getEle mentById("f").s ubmit()
....

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)

Jul 23 '05 #2
Fox
q2005 wrote:
Hi, all

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

Jack


function
handleSubmit(fo rmRef)
{
window.open("", "formTargetWind ow");

formRef.target = "formTargetWind ow";
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.xx x" method=post target=formTarg etWindow>

(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
************
Jul 23 '05 #3
On Thu, 28 Oct 2004 17:29:05 +1000, q2005 <q2***@tpg.com. au> 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.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7082
by: Al Cadalzo | last post by:
I'm trying to simulate a form post (i.e. Method="POST"). The FORM POST I'm trying to simulate is similar to this: <FORM NAME=SearchForm METHOD=POST ACTION=Search> <SELECT name="criteriaA" > <OPTION VALUE=1>AAAAAAAAAAA</OPTION> <OPTION VALUE=2>BBBBBBBBBBBB</OPTION> </SELECT> ....
2
12560
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser <form action="display.aspx" method="post" target="_blank"> will submit the form data and open display.asp in a new browser
1
9355
by: Steve M. | last post by:
Hello all. I have a dropdown list: <select name="select" class="mapMenu" onChange="JumpToIt(this)"> <option selected value="none">Select a Tool --</option> <option value="javascript:onCreatePrintable()">Print Map</option> <option value="javascript:onFindLatLong()">Find Lat/Long</option> </select>
2
29494
by: Eli | last post by:
HI! I made some quiz using one HTML form (few question with few radio-button each like potential answers) that have one Submit button. I would like to simulate click on this button (e.g. named "Finish") after some time, 10 minute or so, which be equal like click on submit button and terminate quiz (open another page or so). I tried to solve it by JavaScript but won't, always error, like can't detect button like object. What to do? Listing...
2
2044
by: scotty | last post by:
I have a ListBox with AutoPostBack='True'. The corresponsing form is set as follows: <form runat='server' method='POST' action='results.asp' name='mbrlst_search' ID='search_form'> When javascript is enabled, I auto-post the form at the bottom of the .aspx page. It works fine. With javascript disabled, however, the action of the form, when the
6
12277
by: BarryX | last post by:
Hi, How do I simulate this from the server side: <form name="SearchForm" method="POST" id="SearchForm" action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2"> I have generally been posting data using: Set xml = Server.CreateObject("Microsoft.XMLHTTP")
1
2482
by: BarryX | last post by:
Hi, How do I simulate this from the server side: <form name="SearchForm" method="POST" id="SearchForm" action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2"> I have generally been posting data using: Set xml = Server.CreateObject("Microsoft.XMLHTTP")
6
29752
by: rpcchandu | last post by:
Hi Coders, I have to redirect from my server to the different server page by simulating the POST method submit from the Controller file, I tried using post_via_redirect, but could not succeed... though redirect_to just redirects to given URL, I need to pass parameters using POST. Configurations: Rails 1.2.3, ruby 1.8.6 (2007-03-13 patchlevel 0) Linux 2.6.9-42 box. I used the following code in the action method:...
4
2077
by: c0mm3nt | last post by:
Hi Guys. I'm writing a web crawler (web spider) that crawl all links in a website. My application is a Win32 App, written in C# with .Net framework 3.5. Now I'm using HttpWebRequest an HttpWebResponse to communicate with the web server. I also built my own Http Parser that can parse anything I want. I found all link like "href", "src", "action"... in the parse. But I can not solve one problem: Simulate Client Script in the page (like JS...
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.