I'm staring blank on this error, so I hope someone here can point out where I go wrong.
This function should replace a parameter's value in a querystring with a new value:
function ReplaceParameter(querystring, key, value) {
var myregexp = new RegExp("(?<="+key+"=).+(?=&)", "i");
return querystring.replace(myregexp, value);
}
example usage:
var serializedData = "columnsToDisplay=EmployeeId&columnsToDisplay=Name&columnsToDisplay=Birthday&columnsToDisplay=Phone&pageSize=4&columnToSort=EmployeeId&descending=False&page=1&partial=RainbowGridData";
var selectedPage = 17;
serializedData = ReplaceParameter(serializedData, "page", selectedPage);
I get an "Microsoft JScript runtime error: Syntax error in regular expression" error." trough visual studio while debugging this website.
Any idea?
Thanks.