• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

URL encode through javascript

I am building a string which has special characters like %. This string needs to be passed in URL.
The string "Type" has the special character.

URL = test.asp?abc=" + Type

Now when I use request.querystring it throws junk characters.
How can I get the exact string which I have passed.
     

0
Subo123
Asked:
Subo123
  • 2
1 Solution
 
CJ_SCommented:
escape and unescape.

escape will add the special characters while unescape will change them back:

var url = "mypage.asp?abc="+escape("a b c");
alert(url);

regards,
CJ
0
 
Subo123Author Commented:
Great! Itz working
0
 
CJ_SCommented:
Why B if it works and it is the only possible answer??
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now