I have a select dropdown with id\'s mapped to values. On the onChange event I want to redirect to the same url but with \'id=value\' appended to the querystring.
How do
I suspect the alleged solution is not working with specific variable names. Especially the line:
RegExp( ';?' + key + '=?[^&;]*', 'g' )
If key is a character sequence present elsewhere within the querystring, that occurrence will be mistakenly replaced also (try one letter, e.g. 'a'). This is because the regex leaves the string boundaries open (leading ';' and trailing '=' are both optional). Maybe the epxression better be something like:
RegExp( '[;&]' + key + '=?[^&;]*', 'g' )
Though I haven't tested it yet.