Click to See Complete Forum and Search --> : passing values to another page


mgilsbach
07-24-2003, 08:53 AM
Hello,

In ASP, I can pass a value to another page with a link like this:

a href="somepage.asp?x=0"

Then I could use the ASP Request object to retrieve the value of "x" and use it in my code on somepage.asp.

Is there any equivalent functionality in client side JS that would allow me to send a value from page one to page two and then use that value in the JS on page two?

Thanks in advance,
Mike

Khalid Ali
07-24-2003, 10:12 AM
yep...send the value to another page using the url as you do in asp and on the other page use the

var data = window.location.search;
this will return everything after the ? in data

requestcode
07-24-2003, 10:25 AM
I believe you need to do it this way to grab the stuff after the question mark:
passdata=unescape(location.search.substring(1,location.search.length))

At least that was the way it was taught to me and it has worked.

Khalid Ali
07-24-2003, 11:04 AM
Originally posted by requestcode

passdata=unescape(location.search.substring(1,location.search.length))


the unescape part is of any sginificance,the rest is not doing anything diferent then this

var data = window.location.search;

user will have to parse for identifiers and their values anyways...

mgilsbach
07-24-2003, 11:04 AM
Cool! They both work well. Thanks to you both!

-Mike

Jeff Mott
07-24-2003, 12:55 PM
162208

;)