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!