title: How to encode URL parameters?
body: <p>I am trying to pass parameters to a URL which looks like this:</p>
  <pre><code>http://www.foobar.com/foo?imageurl=
  </code></pre>
  <p>And I want to pass the parameters such as an image URL which is generated itself by another API, and the link for the image turns out as:</p>
  <pre><code>http://www.image.com/?username=unknown&amp;password=unknown
  </code></pre>
  <p>However, when I try to use the URL:</p>
  <pre><code>http://www.foobar.com/foo?imageurl=http://www.image.com/?username=unknown&amp;password=unknown
  </code></pre>
  <p>It doesn't work.</p>
  <p>I have also tried using <code>encodeURI()</code> and <code>encodeURIComponent()</code> on the imageURL, and that too doesn't work.</p>