How to url encode in JavaScript

Posted by Sheonarayan under JavaScript category on | Points: 40 | Views : 585
To encode the url in JavaScript, following javascript built in functions can be used.

1. encodeURIComponent(string) - to encode querystring parts only

var url = "" + encodeURIComponent('variables in C# artilces');

2. encodeURI(string) - to encode complete url

var url = "" + encodeURI('variables in C# artilces');


Comments or Responses

Login to post response