Reputation: 21
I need to encode an url in javascript and decode it in php.. how can I do this? I tried using encodeURI and encodeURIComponent functions with urldecode in php but it doesnt work...
Upvotes: 1
Views: 3298
Reputation: 920
Encoding URLs in Javascript should work fine with encodeURI(). See here:
In PHP, if the URL you're reading is being passed through a GET parameter, there's no need to decode it. It's already been done. Otherwise, urldecode() is your answer.
You're gonna need to post more info if you need more help.
Upvotes: 2