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...
Asked
Active
Viewed 3,270 times
1
-
1In what way does it not work? Please post some code, what you expect it to output, and what it actually outputs. – tdammers Feb 11 '12 at 19:23
1 Answers
2
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.
-
I understood my problem. I am using codeigniter and it ignores comma char in uri. Do you know how I can solve this problem? – Cemil Tokatlı Feb 11 '12 at 23:38