I need to change the value of query parameter present in the given URL using jQuery.
There are 2 possible URL's like,
www.domain.com/?id=10&name=xxx
and
www.domain.com/?name=xxx&id=10
I need to change the value of parameter id in this URL into something like www.domain.com/?id=15&name=xxx. Regex seems to be the solution for this, but it looks confusing to me.
Possible solution:
Select the string between "id=" and "&" (or) string from "id=" to the end of string and replace it with desired value 15.
Does anyone have solution for this or any other better solution?
Thanks in advance!
hrefin an<a>? In addition, you also need to tell us exactly what you want, not "something like ..." Does what you said mean that you want bothwww.domain.com/?id=10&name=xxxandwww.domain.com/?name=xxx&id=10changed towww.domain.com/?id=15&name=xxx? Do you really care what the order is (it's possible that order matters, but usually it doesn't. You just haven't told us what you actually want)?