L
Larry
Is there a way to know if the current page is a result of a get or
post?
post?
Larry said:Is there a way to know if the current page is a result of a get or
post?
and of course, no.Thomas said:Yes.
Yes.
Scott said:^^^^
No.
At least, assuming you're discussing doing this from Javascript in a
web browser. For any POST you perform, the server could send a
redirect to a GET.
If you have control on the server-side, you could echo the request
type into a JS variable; in PHP it might be
var httpMethod = "<?php echo $_SERVER['REQUEST_METHOD']; ?>"
Right little humourist, is our resident elf...;-)Thomas said:Scott said:^^^^Thomas said:Is there a way to know if the current page is a result of a get or
post?
Yes.
No.
At least, assuming you're discussing doing this from Javascript in a
web browser. For any POST you perform, the server could send a
redirect to a GET.
If you have control on the server-side, you could echo the request
type into a JS variable; in PHP it might be
var httpMethod = "<?php echo $_SERVER['REQUEST_METHOD']; ?>"
See, there is a way
Scott said:^^^^Thomas said:Is there a way to know if the current page is a result of a get or
post?
Yes.
No.
At least, assuming you're discussing doing this from Javascript in a
web browser. For any POST you perform, the server could send a
redirect to a GET.
If you have control on the server-side, you could echo the request
type into a JS variable; in PHP it might be
var httpMethod = "<?php echo $_SERVER['REQUEST_METHOD']; ?>"
See, there is a way
The new page can never know if the page request is
1 a result of a bona fide form-get
or
2 just from a link contaning an URL with querystring.
I'm not sure that is a meaningful distinction. At the HTTP level,
both are GET requests, so even the server doesn't distinguish this.
Evertjan. said:Thomas 'PointedEars' Lahn wrote on 25 jan 2010 in comp.lang.javascript:Scott Sauyet wrote:[OP, ed.]
Is there a way to know if the current page is a result of a get or
post?
var httpMethod = "<?php echo $_SERVER['REQUEST_METHOD']; ?>"
See, there is a way
No there is not.
Evertjan. said:Scott Sauyet wrote on 25 jan 2010 in comp.lang.javascript:
No, they could also be POST requests at ther same time.
I would like an example of an HTTP request that simultaneously uses the
HTTP GET and POST methods.
Eric Bednarz schreef:I would like an example of an HTTP request that simultaneously uses the
HTTP GET and POST methods.
Here is one:
<form action="whatever.php?id=12" Method="POST" name="testform">
Firstname: <input type="text" name="firstname">
<input type="submit">
</form>
[ ... ]
It is a bit weird I admit, but it works just fine.
I read that
as wanting to know the request method, and I would think
that a HTTP server cannot resolve a resource and send response headers
without knowing that.
and send response headers without knowing that.
I wonder what you read.
Eric Bednarz schreef:I would like an example of an HTTP request that simultaneously uses the
HTTP GET and POST methods.
Here is one:
<form action="whatever.php?id=12" Method="POST" name="testform">
Firstname: <input type="text" name="firstname">
<input type="submit">
</form>
[ ... ]
It is a bit weird I admit, but it works just fine.
Well, this still is an HTTP POST request. PHP interprets the query
string of the URL as GET variables, but it is not a GET request.
Scott Sauyet wrote on 26 jan 2010 in comp.lang.javascript:On Jan 26, 5:55ÿam, Erwin Moller
Well, this still is an HTTP POST request. PHP interprets the query
string of the URL as GET variables, but it is not a GET request.
So we should define a GET request in the OQ sense just as a any request
that is not a HTTP POST request [disregarding the HEAD request which has no
clientside coding ability]?
You could do that, but what would be the use for the OP?
Evertjan. said:Eric Bednarz wrote on 26 jan 2010 in comp.lang.javascript:
my sentence?
What HTTP-server
What Resource?
Why should a server without serverside programming ability [if that is what
you mean by HTTP-server],
do anything with the POST content of the request
header?
¿Que?
The request querystring has no special request or response headers.
The POST content is in the request header,
not in the response header.
Evertjan. said:Thomas 'PointedEars' Lahn wrote on 25 jan 2010 in comp.lang.javascript:See, there is a wayScott said:Thomas 'PointedEars' Lahn wrote:
Is there a way to know if the current page is a result of a get or
post?
Yes. ^^^^
No.
At least, assuming you're discussing doing this from Javascript in a
web browser. For any POST you perform, the server could send a
redirect to a GET.
If you have control on the server-side, you could echo the request
type into a JS variable; in PHP it might be
var httpMethod = "<?php echo $_SERVER['REQUEST_METHOD']; ?>"
No there is not.
The new page can never know
Scott said:I'm not sure that is a meaningful distinction. At the HTTP level,
both are GET requests, so even the server doesn't distinguish this.
Eric said:I would like an example of an HTTP request that simultaneously uses the
HTTP GET and POST methods.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.