Add Custom Parameter To URL - jQuery PushDataToUrl

Add Custom Parameter To URL - jQuery PushDataToUrl
File Size: 24.5 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

PushDataToUrl is a small jQuery plugin which enables the developers to dynamically append parameters (key/value) to the current URL without refreshing the page.

How to use it:

1. Install & download.

# NPM
$ npm install push-data-to-url --save

2. Load the pushToUrl.jQuery.js script from the src folder.

<script src="https://code.jquery.com/jquery-3.4.0.slim.min.js" 
        integrity="sha384-7WBfQYubrFpye+dGHEeA3fHaTy/wpTFhxdjxqvK04e4orV3z+X4XC4qOX3qnkVC6" 
        crossorigin="anonymous">
</script>
<script src="./src/pushToUrl.jQuery.js"></script>

3. Or from the CDN.

<script src="https://code.jquery.com/jquery-3.4.0.slim.min.js" 
        integrity="sha384-7WBfQYubrFpye+dGHEeA3fHaTy/wpTFhxdjxqvK04e4orV3z+X4XC4qOX3qnkVC6" 
        crossorigin="anonymous">
</script>
<script src="https://unpkg.com/push-data-to-url"></script>

4. Add key/value to the URL.

pushToUrl('add', {
  key: 'jqueryscript', 
  value: '12345'
});

5. Remove a specific parameter from the URL.

pushToUrl('removeSelected', {
  key: 'jqueryscript'
});

6. Remove all parameters from the URL..

pushToUrl('removeAll');

Changelog:

2019-04-17

  • beautify method call

This awesome jQuery plugin is developed by baralmanish. For more Advanced Usages, please check the demo page or visit the official website.