Friday, September 29, 2023
HomejQuerySimple URL Question String Manipulation Plugin - jQuery querystring.js

Simple URL Question String Manipulation Plugin – jQuery querystring.js

Question strings (also called URL question parameters) are utilized in a number of locations all through web sites and internet purposes. They permit including additional info to the tip of a URL(request), and can be utilized for a lot of various things, resembling passing state between requests inside your utility and even for person identification.

On this article I will introduce you to a tiny jQuery plugin that you should use to simply dynamically add/modify/delete/get question strings utilizing plain JavaScript. It helps commonplace question strings, non-standard slash question strings, and hash strings.

See Additionally:

Learn how to use it:

1. To get began, embrace the jquery.querystring.min.js script after jQuery library.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/cdn/jquery.querystring.min.js"></script>

2. Create a brand new occasion of the queryString

// primary
var occasion = new $.queryString();

// OR
var occasion = new $.queryString('jqueryscript');
=> /path/to/jqueryscript?key=worth

// OR
var occasion = $.queryString("https://www.jqueryscript.internet");
=> https://www.jqueryscript.internet/?key=worth

3. Set question/hash string parameters.

// set commonplace parameters
occasion.params.howdy = "world";
occasion.params["dashed-key"] = "dashed-value";
occasion.params["encoded-key"] = "worth)";

// set hash values
occasion.hash.web page = 1;
occasion.hash.row = 42;

4. Get all question/hash string parameters.

// get commonplace parameters
var worth = occasion.params[key];, worth);

// get hash values
var worth = occasion.hash[key];, worth);

5. Delete all question/hash string parameters.

// delete commonplace parameters
delete occasion.params.key;

// delete hash values
delete occasion.hash.key;

6. Obtainable choices.

var occasion = new $.queryString(url, {

    // encode question string
    encode: true,

    // commonplace, slash
    format: "commonplace", 

    // callback
    encodeCallback: encode,

This superior jQuery plugin is developed by godlikemouse. For extra Superior Usages, please verify the demo web page or go to the official web site.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments