3

Hi I have this URL (top) I'm trying to use with "pinterest" they change the url (bottom). Does anybody know how I can change my (top) url to be the same as the "pinterest" url. Is there a Jquery plugin? or somthing like (decodeURIComponent)??? Maybe there is nothing other than using .replace. I thought I would ask first. Thanks

 http://my.site.com/folder/shadez/zoom.php?returntype=2&size=small&images[]=Base.jpg&images[]=Frame_Clear.png&images[]=Left_Clear.png&images[]=Right_Clear.png&images[]=Lenses_Lenses-Semi-Clear.png

 http%3A%2F%2Fmy.site.com%2Ffolder%2Fshadez%2Fzoom.php%3Freturntype%3D2%26size%3Dsmall%26images%5B%5D%3DBase.jpg%26images%5B%5D%3DFrame_Clear.png%26images%5B%5D%3DLeft_Clear.png%26images%5B%5D%3DRight_Clear.png%26images%5B%5D%3DLenses_Lenses-Semi-Clear.png
user2238083
  • 583
  • 2
  • 9
  • 21

1 Answers1

0

You can use the encodeURIComponent & decodeURIComponent function of javascript.

 encodeURIComponent(uour_url)

 decodeURIComponent(encoded_uri)

Check this http://jsfiddle.net/aGQFK/1/

Ashis Kumar
  • 6,494
  • 2
  • 21
  • 36
  • 1
    `encodeURIComponent` should generally be preferred over `encodeURI`. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI#Description – Matt Ball Aug 13 '13 at 03:06