Reputation: 3058
I need to do 2 things:
One of the parameters is redirect=URL_here
.
The problem is, that i must redirect to that page: /about/me?look=1&sort=asc
Then, my URL looks like:
/mypage/?letter=S&redirect=/about/me?look=1&sort=asc
I know that this is wrong (contains two "?"). The question is, how to make that query string correctly?
Upvotes: 2
Views: 14501
Reputation: 3281
Use Url encode
Like this
<script>
var c= 'd e'
var query= '?a=b&c='+encodeURIComponent(c);
var uri= 'http://www.example.com/script?query='+encodeURIComponent(query);
window.location= uri;
</script>
and use
decodeURIComponent()
to decode
Upvotes: 0
Reputation: 5331
change =
sign with your own like ||
on your link. In your case change link like this
/about/me?look||1&sort||asc
Then later you will change ||
with =
Upvotes: 0