Download This Plugin Back To jQueryScript
A set of functions to easily manipulate and interact with URLs in your web applications.
You can change the URL by calling the function $.urlChange(pathname)
.
Parameters:
- pathname is required and must be a URL pathname.
Example:
Also you can easly change the URL by using the HTML attribute data-url-change="/pathname"
Need a callback? Use data-callback="functionName()"
.
Example:
You can change the URL pathname by calling the function $.addPathname(pathname, queryParams)
.
Parameters:
- pathname (URL pathname) [string | required]
- queryParams (Query parameters) [object].
Example:
Also you can easly change the URL pathname by using the HTML attribute data-url-pathname="/pathname"
Need a callback? Use data-callback="functionName()"
.
Example:
You can add or replace the query parameter by calling the function $.addUrlParam(key, value)
.
Parameters:
- key (Query parameter key) [string | required]
- value (Query parameter value) [string | numeric | required].
Example:
Also you can easly add or replace the query parameter by using the HTML attribute
data-url="add-param" data-key="animal" data-value="lion"
Need a callback? Use data-callback="functionName()"
.
Example:
You can get all query parameters by calling the function $.getUrlParams(url)
.
Parameters:
- url (By default: current URL) [string]
Example:
You can get single query parameter by calling the function $.getUrlParam(key)
.
Parameters:
- key (Query parameter key) [string | required]
Example:
You can delete a query parameter by calling the function $.removeUrlParam(key)
.
Parameters:
- key (Query parameter key) [string | required]
Example:
Also you can easly delete a query parameter by using the HTML attribute
data-url="remove-param" data-key="color"
Need a callback? Use data-callback="functionName()"
.
Example:
˝ ˝
You can remove all query parameters by calling the function $.setUrlParams(null)
.
Example:
Also you can easly remove all a query parameters by using the HTML attribute data-url="remove-all-params"
Need a callback? Use data-callback="functionName()"
.
Example: