How to change get parameters?

let's say there are buttons:
{black}
{white}
{_m_}
{_s_}

how to make so that when you press the button {white}, threw in a link site.ru/?color=white
and then when you click on knokw {_s_} entered the site.ru/?color=white&?size=s
and then when you click on {black} entered the site.ru/?color=black&?size=s

I hope the meaning is clear, thanks in advance
March 23rd 20 at 19:32
3 answers
March 23rd 20 at 19:34
Solution
Don't know how reasonable this method, but
$("#footwear").click(function() {
 if (params['category'] == 'clothing') {
 var link = window
.location
.search
 .replace('clothing', 'footwear');
console.log(link);
};
});
March 23rd 20 at 19:36
Solution
In haste, but the point I think is understandable. Window.location.href in the code need to recommendit.

March 23rd 20 at 19:38
<form action="?">
<input type="submit" name="color" value="black">
<input type="submit" name="color" value="white">
<input type="submit" name="size" value="_m_">
<input type="submit" name="size" value="_s_">
</form>
the fact that the parameter is not added - Jerel commented on March 23rd 20 at 19:41

Find more questions by tags JavaScript