Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Jan 5, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

An Improved escape() Function in Javascript

Currently Javascript's escape() has some limitations. For instance, if you want to pass a+b not a b, you want to get the literal "+" in the server side. Javascript's escape function does not replace the "+" with a hexadecimal value, so when it is received on the server, it will be treated as a blank space rather than as a "+." The function below will replace all special characters with hexadecimal format functions just like ASP's Server.URLEncode() function.
function urlencode(strValue) {
	var charValue,blnValidChar,charCodeValue;
	var strEncodedValue='';
	for(var i=0;i
Prasad Haridass
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date