Let\'s say I have a string: something
When I escape it in JS I get this: %73%6F%6D%65%74%68%69%6E%67
so I can use this code
PHP:
rawurlencode("your funky string");
JS:
decodeURIComponent('your%20funky%20string');
Don't use escape as it is being deprecated.
escape