Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.
/ urlmod Public archive

A jquery plugin that makes it simple to take a URL and update it's parameters.

License

Notifications You must be signed in to change notification settings

gregwhitworth/urlmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

urlmod

This is a lightweight URL parameter updater, nothing more and nothing less.

Basic Usage

To install, simply include the javascript file after jquery (it's best to place it just before the closing </body> tag).

<script src="jquery.urlmod.v1.0.js"></script>

Then all you have to do is pass in your URL and the parameters that you want to have updated.

var url = $.urlmod({
	url: "http://www.domain.com/?param1=value1&param2=value2",
	updates: {
		param1: "value75",
		param2: "value175"
	}
});

// Return value: http://www.domain.com/?param1=value75&param2=value175

Options

  • url: This is the URL that has the parameters you want updated Default: null (string)
  • updates: This is an object that has a key/value pair where the keys match the names of parameters in the initial URL. If you have parameters in your update object that are not referenced in your initial URL they will be added. If you provide an array as a value it will be converted to a string seperated by a comma. Default: {} ({key: <string, array>})
  • removeStaleParams: If this is set to true any parameters that existed initially that you did not update will not be included in the return URL. Default: false (bool)

About

A jquery plugin that makes it simple to take a URL and update it's parameters.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published