Some values being changes when passing through URL

S

sancha

Hi,
i am trying to pass values to a struts action using javascript. It
works fine until the value has something like '+' or '&' sign in it.
Is this a problem with javascript or these values cannot be passed in
the URL ?

takeExample.do?field='+field+'&Code='+code

this is the url im making

if code is 'trying + something else'
i get 'trying something else' from the request.getParameter

if it is 'trying & something else'
i get 'trying '


Please Help
Thnax in advance
 
M

McKirahan

sancha said:
Hi,
i am trying to pass values to a struts action using javascript. It
works fine until the value has something like '+' or '&' sign in it.
Is this a problem with javascript or these values cannot be passed in
the URL ?

takeExample.do?field='+field+'&Code='+code

this is the url im making

if code is 'trying + something else'
i get 'trying something else' from the request.getParameter

if it is 'trying & something else'
i get 'trying '


Please Help
Thnax in advance

Look into JavaScript's escape() and unescape():

http://www.devguru.com/Technologies/ecmascript/quickref/escape.html
http://www.devguru.com/Technologies/ecmascript/quickref/unescape.html
 
M

Michael Winter

[snip]
Look into JavaScript's escape() and unescape():

The escape and unescape functions are deprecated. They are also
inappropriate when not applied to the entire URL (as in this case).

See my post to the earlier incarnation of this thread.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top