How can I replace dynamic value in javascript/jquery?
I have a string like this myURL = http://www.demo.com?a=1&sp=2&c=3; I want to replace sp=2 with string like 'str=3'. The value of 'sp' can change like 3,4,5, etc.
I am using replace function of jQuery, but I am not sure how can I replace the dynamic value of 'sp'
myURL.replace("sp=2", "str=3");
Any idea?