Some values being changes when passing through URL

Discussion in 'Javascript' started by sancha, Jan 5, 2005.

  1. sancha

    sancha Guest

    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
     
    sancha, Jan 5, 2005
    #1
    1. Advertising

  2. sancha

    McKirahan Guest

    "sancha" <> wrote in message
    news:...
    > 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
     
    McKirahan, Jan 5, 2005
    #2
    1. Advertising

  3. On Wed, 05 Jan 2005 11:12:57 GMT, McKirahan <> wrote:

    [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

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Jan 5, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Piotrek \Alchemik\
    Replies:
    0
    Views:
    310
    Piotrek \Alchemik\
    Nov 12, 2006
  2. gerryR

    passing values through url

    gerryR, Mar 17, 2010, in forum: ASP .Net
    Replies:
    6
    Views:
    516
    gerryR
    Mar 19, 2010
  3. Martin
    Replies:
    0
    Views:
    1,222
    Martin
    Apr 28, 2010
  4. Peter
    Replies:
    2
    Views:
    330
    Peter
    May 15, 2006
  5. Aaron
    Replies:
    2
    Views:
    530
    dhtml
    Apr 10, 2011
Loading...

Share This Page