JavaScript decodeURIComponent() Function

JavaScript decodeURIComponent() Function

The decodeURIComponent() function decodes a URI component.
Tip: Use the encodeURIComponent() function to encode a URI component.

Syntax:

decodeURIComponent(uri)

Example:


<script language="JavaScript">
var uri="http://paktutorial.com/my test.asp?name=ståle&amp;car=saab";
var uri_encode=encodeURIComponent(uri);
document.write(uri_encode);
document.write("&lt;br /&gt;");
document.write(decodeURIComponent(uri_encode));

</script>
</body>

OUTPUT

http%3A%2F%2Fpaktutorial.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab
http://paktutorial.com/my test.asp?name=ståle&car=saab

DOWNLOAD SOLUTION HERE