JavaScript encodeURI() Function

The encodeURI() function is used to encode a URI.This function encodes special characters, except: , / ? : @ & = + $ # (Use encodeURIComponent() to encode these characters).Tip: Use the decodeURI() function to decode an encoded URI.

Syntax

encodeURI(uri)

Example

<script language="JavaScript">
var uri="my test.asp?name=ståle&amp;car=saab";
document.write(encodeURI(uri)+ "<br />");
</script>

OUTPUT:

my%20test.asp?name=st%C3%A5le&car=saab
DOWNLOAD SOLUTION HERE