I am trying to pass parameters to a URL which looks like this:
http://www.foobar.com/foo?imageurl=
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:
http://www.image.com/?username=unknown&password=unknown
However, when I try to use the URL:
http://www.foobar.com/foo?imageurl=http://www.image.com/?username=unknown&password=unknown
It doesn’t work.
I have also tried using encodeURI() and encodeURIComponent() on the imageURL, and that too doesn’t work.
With PHP
Result
With Javascript:
DEMO: http://jsfiddle.net/Lpv53/