i have a url that has several parameters, and i want to replace them using JQuery (not javascript).
var str = "http://example.com/index.php?color=red&size=large&quantity=5";
var newQty = 10;
How can i change the quantity using JQuery ONLY if quantity exists as a parameter? How can i change a parameter that isn't at the end of the query string, such as size=large?
I prefer to use regex and .replace function, if anyone can help me with the proper code please... something like this.
var newStr = str.replace(REGEX, "quantity="+newQty);