|
-
Oct 21st, 2002, 08:37 AM
#1
Thread Starter
Addicted Member
Returning values from JavaScript functions
I'm trying to use JavaScript to do some interesting things. However, I'd like to do *something* with what is generated.
For example, if I have a simple JavaScript function that I specify to return a string e.g. "hello", how can I get that return value and put it in a JSP variable.
If this is not possible then so be it, but I'm sure it can be done.
Thanks in advance
HD
-
Oct 21st, 2002, 09:00 AM
#2
Frenzied Member
Code:
function returnSomething($1,$2){
return $1 + $2;
}
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Oct 21st, 2002, 09:02 AM
#3
Frenzied Member
Sorry... didn't read the question fully. I don't know about JSP but in ASP I use alot of querystring passing to transfer client side variables to server side.
Michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Oct 21st, 2002, 10:04 AM
#4
Thread Starter
Addicted Member
What do you mean?
I've basically got a situation where I need to pass an array of variables from a JSP to another page. I've been looking into the javascript side because it might have been useful.
How can you pass an object (in this case an array of strings) across pages?
Thanks again
HD
-
Oct 21st, 2002, 10:15 AM
#5
Frenzied Member
Well, like I said I don't know JSP but in ASP I use the javascript window.open then in the page I opened I read in the varables I passed via the query string. I use window open cos I do a wierd this w/hidden frames alot so you would pass it however you normaly open the new page.
page 1 (blah in this example will be the value that you pass to the function.
Code:
window.open('page2.asp?Var1' + blah);
page2 (this is ASP, I don't know JSP)
Code:
strVar1 = Request.QueryString("Var1")
Hope that makes sense 
Michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Oct 21st, 2002, 10:16 AM
#6
Frenzied Member
as for an array that might be different... you may have to unload it and pass one at a time and reload into an array on the other side.
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Oct 21st, 2002, 10:20 AM
#7
Thread Starter
Addicted Member
Thanks. I've done some of that - you can use the request.getParameterValues("param") etc. functions in JSP, but its pretty much the same.
I was hoping to not have to pass the array elements one by one - but we'll have to see.
Thanks again.
HD
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|