I'm trying to add a value to a search parameter in an URL but it's partly not working. For example I've this URL:
http://localhost.com/?color=Green&size=L
How can I add now a second value to color separated with a ,
?
This is how the URL must look after setting a second param:
http://localhost.com/?color=Green,Red&size=L
I've tried it with this here:
window.history.pushState(null, null, window.location.search + ',' + 'Red');
But the result is:
http://localhost.com/?color=Green,Red&size=L,Red
So how can I add a value comma separated to a search parameter in my URL?