473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 59632
Richard Hockey wrote on 07 jul 2003 in comp.lang.javascript:
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='process.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="whatever.php" method="POST">
<select name="selectName">
<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="nextpage.asp" method="POST">
<select name="selectName" onChange="document.MyForm.submit">
<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
"reneeccwest" <re*********@hotmail.com> wrote in message
news:9f**************************@posting.google.c om...
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

0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...

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.