473,654 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to similate HTTP POST request by JavaScript?

How can I simulate HTTP post request by JavaScript?

When I select from <SELECT> combo box. onClick will call JavaScript
function.
I want this function to send HTTP POST request with the selected index of
the combo box.
To do this, somehow the function must simulate HTTP POST request.

Thanks in advance.
Jul 20 '05 #1
3 59646
Richard Hockey wrote on 07 jul 2003 in comp.lang.javas cript:
I'm not sure you can 'simulate' a HTTP post request, but you can
submit a form using javascript to set the method, and to execute from
submission (you can also set the action and target window):

document.forms['myform'].method='post';
document.forms['myform'].action='proces s.php';
document.froms['myform'].target='_self' ;
document.forms['myform'].submit();


You are right.

It is not simulating a post http-request,

but simulating a classical HTTP-only post request.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2


reneeccwest wrote:
How can I simulate HTTP post request by JavaScript?

When I select from <SELECT> combo box. onClick will call JavaScript
function.
I want this function to send HTTP POST request with the selected index of
the combo box.
To do this, somehow the function must simulate HTTP POST request.


Why don't you use HTML?
<form action="whateve r.php" method="POST">
<select name="selectNam e">
<option>...</option>
<option>...</option>
...
</select>
<input type="submit">
</form>

The browser will send a HTTP POST request when the submit button is
clicked/pressed without needing any script.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
<form name="MyForm" action="nextpag e.asp" method="POST">
<select name="selectNam e" onChange="docum ent.MyForm.subm it">
<option>make a selection</option>
<option value = "one">one</option>
<option value = "two">two</option>
...
</select>
<input type="submit">
</form>
try something like this. Onclick is wrong because as soon as you click it
would send, without you chnaging anything.

Keep a submit button available for non JS users.

Does that help? If not, let us see some code and tell us exactly what you
want it to do.

Stu
"reneeccwes t" <re*********@ho tmail.com> wrote in message
news:9f******** *************** ***@posting.goo gle.com...
How can I simulate HTTP post request by JavaScript?

When I select from <SELECT> combo box. onClick will call JavaScript
function.
I want this function to send HTTP POST request with the selected index of
the combo box.
To do this, somehow the function must simulate HTTP POST request.

Thanks in advance.

Jul 20 '05 #4

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

Similar topics

1
8489
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
7307
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
6161
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
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.