Folks, I am trying to figure out a way to replace query parameters using JS and having a hard time figuring this out. Any help will be greatly appreciated.
In code, get_param identifies st_price but it is unable to replace the string.
_uri = '/default.aspx?&search[st_date]=09/09/2009&search[en_date]=09/10/2009&search[st_rate]=500&search[en_rate]=900';
_new_url = _uri.replace(get_param('search[st_price]'),'search[st_price]'+ui.values[0])
function get_param( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else {
_ret = name+'='+results[1];
return _ret;
}