How to use encodeURIComponent in JavaScript
This article describe about encodeURIComponent() Function in JavaScript.
encodeURIComponent() Function in JavaScript
For encode a URI component use encodeURICompent() function.
It is used to encode the special character like characters: , / ? : @ & = + $ #.
Note: To decode an encoded URI component use the decodeURIComponent().
Syntax
Parameter |
Description |
uri |
Required. uri to encoded. |
Example
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var uri = "https://dotnetheaven.com/default.aspx?name=ståle&car=raman";
document.write(encodeURIComponent(uri));
</script>
</body>
</html>
|
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here