I'm trying to pass a url like:
my_url = 'http://somedomain.com/somepath/somepage?key="query"';
when someone clicks on a form.
I tried using encodeURI and encodeURIComponent and even using alerts to see that I have either "query" or %22query%22 because I call something like document.my_form.action = my_url but when the browser hits to that page, I get:
http://somedomain.com/somepath/somepage?key=query
The double quotes are missing. Similar tries with '=', '@' all are retained… is there something I'm missing?
Thanks.
Best Answer
Using a query string in an action attribute of a GET-method form will result in the query being overwritten by the variables of the form itself.
You can try to add your values as hidden input fields (using JavaScript).
I tried your code, and it works great for me: