Is it possible to encode a URL in JavaScript?

I learned in PHP to encode a URL and send it using GET method. Is it possible to do the same in JavaScript?

var url1 =

I want to encode this and then send it as a GET parameter of another URL.


  • var yourOtherURL = "" + encodeURIComponent(url1);

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion