Skip to content

queryStringHandler updateParameter

Mike Byrne edited this page Jan 25, 2022 · 2 revisions

description

Updates a specified key's value in a query string

requires

  • nothing

parameters

  • url - required - URL to update
  • key - required - key to update, if the key doesn't exist, it gets added
  • value - required - value to update, can handle ''

returns

  • new URL string with updated parameter

example usage:

var initialURL = 'http://a17-js-helpers.com?foo=bar&baz=qux';
var newURL = queryStringHandler.updateParameter(initialURL, 'baz', 'bar'); // returns http://a17-js-helpers.com?foo=bar&baz=qux
Clone this wiki locally