Prev: triplet question.
Next: extend prototype chain?
From: The Natural Philosopher on 25 Jan 2010 11:49 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
From: Evertjan. on 25 Jan 2010 16:00 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)
From: Scott Sauyet on 25 Jan 2010 16:25 On Jan 25, 4:00 pm, "Evertjan." <exjxw.hannivo...(a)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
From: Evertjan. on 25 Jan 2010 17:27 Scott Sauyet wrote on 25 jan 2010 in comp.lang.javascript: > On Jan 25, 4:00�pm, "Evertjan." <exjxw.hannivo...(a)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)
From: Eric Bednarz on 25 Jan 2010 19:28
"Evertjan." <exjxw.hannivoort(a)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. |