[thelist] JS: Snippet to grab GET/POST value?

Jeff Howden jeff at jeffhowden.com
Mon Aug 18 16:05:23 CDT 2003


frank,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Frank
>
> Can someone recommend the simplest way to retrieve a
> get/post value using javascript?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

get values are in the url and therefore accessible to javascript.

try this on for size:
http://evolt.jeffhowden.com/jeff/code/js_url_variables/index.cfm

post values are in the http headers making them inaccessible to javascript.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> I want it so that I can do something of this nature:
>
> function isThisReloaded() {
>     var url_value = '';
>     if (my_url_value == 1) {
>        doThisFunkyThing();
>     } else {
>        doNada();
>     }
> }
> onload = isThisReloaded;
>
> if the value my_url_value  is found in the get or
> post values another function gets triggered,
> otherwise, it just ignores it.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

are you trying to keep users from reloading a page that results in a form
post?

i personally don't think there's any way to reliably detect whether a page
has been reloaded or not.

perhaps if you explain what you're actually trying to accomplish you'll get
a more helpful answer.

thanks,

.jeff

------------------------------------------------------
Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/




More information about the thelist mailing list