Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   get or post? (http://www.velocityreviews.com/forums/t940351-get-or-post.html)

Larry 01-25-2010 10:09 AM

get or post?
 
Is there a way to know if the current page is a result of a get or
post?


Thomas 'PointedEars' Lahn 01-25-2010 11:13 AM

Re: get or post?
 
Larry wrote:

> Is there a way to know if the current page is a result of a get or
> post?


Yes.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)


The Natural Philosopher 01-25-2010 11:35 AM

Re: get or post?
 
Thomas 'PointedEars' Lahn wrote:
> Larry wrote:
>
>> Is there a way to know if the current page is a result of a get or
>> post?

>
> Yes.
>

and of course, no.

Depending on where you are looking at the 'current page' :-)

>
> PointedEars


Scott Sauyet 01-25-2010 11:36 AM

Re: get or post?
 
On Jan 25, 6:13*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
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']; ?>"

Good luck,

-- Scott


Thomas 'PointedEars' Lahn 01-25-2010 12:24 PM

Re: get or post?
 
Scott Sauyet wrote:

> 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']; ?>"


See, there is a way :)


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

The Natural Philosopher 01-25-2010 04:49 PM

Re: get or post?
 
Thomas 'PointedEars' Lahn wrote:
> Scott Sauyet wrote:
>
>> 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']; ?>"

>
> See, there is a way :)
>
>

Right little humourist, is our resident elf...;-)

> PointedEars


Evertjan. 01-25-2010 09:00 PM

Re: get or post?
 
Thomas 'PointedEars' Lahn wrote on 25 jan 2010 in comp.lang.javascript:
> Scott Sauyet wrote:
>
>> 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']; ?>"

>
> See, there is a way :)


No there is not.

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.

You can never know if the page request is from a
form-post just if it tests positive a querystring
as this could be contained in the form post action='...?a=b'.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Scott Sauyet 01-25-2010 09:25 PM

Re: get or post?
 
On Jan 25, 4:00*pm, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
> 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.

-- Scott

Evertjan. 01-25-2010 10:27 PM

Re: get or post?
 
Scott Sauyet wrote on 25 jan 2010 in comp.lang.javascript:

> On Jan 25, 4:00’pm, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
>> 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.


No, they could also be POST requests at ther same time.

If you define a GET request als if without a querystring,
the whole OQ is meaningless.

The only interesting Q is if there is POST content
and if there is querytring content.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Eric Bednarz 01-26-2010 12:28 AM

Re: get or post?
 
"Evertjan." <exjxw.hannivoort@interxnl.net> writes:

> 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.


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.

I wonder what you read.


All times are GMT. The time now is 06:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.