473,785 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question about post/get

Hi, all

When I do as the following, it becomes a GET action to the the server. How
do I make it as a POST action? That means I don't want the string after "?"
show on URL bar and, to the server, it can follow POST function to get the
data passed in. Thank you very much!

window.open("../../Server.php?"+xs Value, "", zNONHTML_STYLE) ;
Jack
Jul 23 '05 #1
18 1716
Ivo
"q2005" wrote
When I do as the following, it becomes a GET action to the the server. How do I make it as a POST action? That means I don't want the string after "?" show on URL bar and, to the server, it can follow POST function to get the data passed in. Thank you very much!

window.open("../../Server.php?"+xs Value, "", zNONHTML_STYLE) ;


This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can
be built dynamically:
var f=document.crea teElement('form ');
document.body.a ppendChild(f);
f.action='../../Server.php';
f.method='post' ;
var i=document.crea teElement('inpu t');
f.appendChild(i );
i.type='hidden' ;
i.name='somenam e';
i.value=xsValue ;
f.submit();

HTH
--
Ivo
Jul 23 '05 #2
Thanks, Ivo. It's so helpful. By the way, after summit, how do I delete the
form object? Thanks again!

Jack
This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can
be built dynamically:
var f=document.crea teElement('form ');
document.body.a ppendChild(f);
f.action='../../Server.php';
f.method='post' ;
var i=document.crea teElement('inpu t');
f.appendChild(i );
i.type='hidden' ;
i.name='somenam e';
i.value=xsValue ;
f.submit();

HTH
--
Ivo

Jul 23 '05 #3
Ivo
"q2005" wrote
This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can be built dynamically:
var f=document.crea teElement('form ');
document.body.a ppendChild(f);
f.action='../../Server.php';
f.method='post' ;
var i=document.crea teElement('inpu t');
f.appendChild(i );
i.type='hidden' ;
i.name='somenam e';
i.value=xsValue ;
f.submit();
Thanks, Ivo. It's so helpful. By the way, after summit, how do I delete the form object? Thanks again!


You don't. The form is submitted, so the whole page is 'deleted' as the
server responds with a brand new page. Note that the example code provided
does not test for features before using them. Include
if(document.cre ateElement) {...} and stuff like that before using it in the
real world. Also, try to avoid relying on javascript. If you can do it with
an ordinary form, and it sounds like you can, then do.
HTH
--
Ivo
Jul 23 '05 #4
Thanks a lot, Ivo.
How do I let it be opened in a separate window after submmit?

Jack
Jul 23 '05 #5
Ivo
"q2005" aka Jack wrote
How do I let it be opened in a separate window after submmit?


In standard HTML, you can add a target attribute to the form opening tag and
it will behave just like the target attribute of <a> tags:

<form action="..." method="..." target="_blank" >

Amazing, isn't it?
In Javascript, to get the same result, you could add this line to the code
we discussed earlier:

f.target='_blan k';

--
Ivo
Jul 23 '05 #6
Thanks very much, Ivo. It works!

Jack

In standard HTML, you can add a target attribute to the form opening tag and it will behave just like the target attribute of <a> tags:

<form action="..." method="..." target="_blank" >

Amazing, isn't it?
In Javascript, to get the same result, you could add this line to the code
we discussed earlier:

f.target='_blan k';

--
Ivo

Jul 23 '05 #7
Hi, Ivo
I tried this script and found "i.type='hidden ';" won't work. I changed to
"i.type='text'; " , it works. But it will show on the original page.

Jack

"Ivo" <no@thank.you > wrote in message
news:41******** *************** @news.wanadoo.n l...
"q2005" wrote
When I do as the following, it becomes a GET action to the the server.

How
do I make it as a POST action? That means I don't want the string after

"?"
show on URL bar and, to the server, it can follow POST function to get

the
data passed in. Thank you very much!

window.open("../../Server.php?"+xs Value, "", zNONHTML_STYLE) ;


This is a GET request, yes, but only if javascript is available. Without
javascript it is nothing.
If you want to POST something, there is no around using a form. If the
reliance on javascript is not a problem (but it usually is), this form can
be built dynamically:
var f=document.crea teElement('form ');
document.body.a ppendChild(f);
f.action='../../Server.php';
f.method='post' ;
var i=document.crea teElement('inpu t');
f.appendChild(i );
i.type='hidden' ;
i.name='somenam e';
i.value=xsValue ;
f.submit();

HTH
--
Ivo

Jul 23 '05 #8
On Tue, 16 Nov 2004 20:11:56 +1000, q2005 <q2***@tpg.com. au> wrote:
I tried this script and found "i.type='hidden ';" won't work.
I assume you mean with IE?

According to Microsoft, the type attribute "is read[-many]/write-once, but
only when an input element is created with the createElement method and
before it is added to the document."

To be safe, the appendChild (or similar, like insertBefore) should be the
very last operation with a dynamically-created element. Set all of the
properties, and only then should said element be added.
I changed to "i.type='text'; " , it works.


Actually, I doubt that. The assignment will still probably fail, but
because text is the default type, it appears as though it succeeded.

[snip]

Mike
Please don't top-post.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #9
Thanks, Michael.
I tried this script and found "i.type='hidden ';" won't work.
I assume you mean with IE?

Yes, I mean with IE.
According to Microsoft, the type attribute "is read[-many]/write-once, but
only when an input element is created with the createElement method and
before it is added to the document."

To be safe, the appendChild (or similar, like insertBefore) should be the
very last operation with a dynamically-created element. Set all of the
properties, and only then should said element be added.


After put the appendChild() at the very last, there is no more error!

Jack
Jul 23 '05 #10

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

Similar topics

65
5394
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++ language. A C++ interface installation IS ABOUT THE C++ LANGUAGE! The language does not possess the ability to handle even simple file directory manipulation. Those wise people that created it did not take care of it. So, BOOST is a portable...
46
4160
by: sbayeta | last post by:
Hi, I'd like to know who is responsible of memory recycling and defragmentation in a C/C++ program, assuming all the memory allocation/deallocation is done using malloc/free or new/delete. Thanks
15
1872
by: designconcepts | last post by:
bo'jour, bo'jour, So I have question to present to the forum about OOD. This is a Csharp forum, but C# is the lang of choice and the question is an exercise based on some comments by the chief designer of C#. Those of you who are junkies for design principle might be interested in contributing to this thread. I was recently reading some interviews with the chief engineer for C# (formerly Mr. Delphi), and he made an interesting comment...
4
1239
by: BM | last post by:
Hello, Ok, Im new to using ASP.NET and IIS so im not sure how or where to post this question but here goes: I am running IIS 5.1 on WinXP. I need to process http POST messages sent from another application that I dont have control over. The messages are sent to a web page called test.htm . The message looks similiar to the following:
10
3441
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a database or continue to process on to the next page. I am now trying to learn ASP to see if we can replace some of our applications that were written in php with an ASP alternative. However, after doing many searches on google and reading a couple...
10
3738
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server Error in '/QuickStartv20' Application. -------------------------------------------------------------------------------- Configuration Error Description: An error occurred during the processing of a configuration file
29
3579
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this one data field - but i'm not sure) :-) Background info:
53
4095
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
10
2548
by: stwebmail | last post by:
If you are dealing with one PCI card, is there a way (from within a dll) to find out which PCI slot that card is inhabiting (1 or 2 or 6, etc.)? It doesn't matter if the solution is MFC, or straight C++/C, just has to be on a Windows machine.
0
887
by: TamusJRoyce | last post by:
I know it's bad to cross post, but I'm not sure if this is a VB or a .Net question, since I'm a C++ programmer primarily. My code I'm working on is VB .Net, and I'm not familiar with the Framework to know if it's a framework or language question. To Moderator: Please move http://bytes.com/forum/thread850506.html here if it is, and you think it is worthy of being a good question (I wonder if this question could turn into a good tutorial, if...
0
9645
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
10341
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...
1
10095
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,...
1
7502
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
6741
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
5383
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
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
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
3
2881
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.