Solved

URL encode through javascript

Posted on 2001-06-14
3
179 Views
Last Modified: 2006-11-17
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
Comment
Question by:Subo123
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
Comment Utility
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
 

Author Comment

by:Subo123
Comment Utility
Great! Itz working
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
Why B if it works and it is the only possible answer??
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now