Skip to content

darlesson/jquery-querystring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

This code was created to make easier to get and to treat query strings. It may return the value of one query string, a collection of query strings, the length, select query string by its index and turn off the case sensitivity. Visit the official website for more details.

Installing

Download the files and add the following to your website

    // If you don't have the jQuery file already informed, insert the code bellow
    <script type="text/javascript" src="javascript/jquery-1.4.2.min.js"></script>

    // Insert the source file
    <script type="text/javascript" src="source/querystring-1.1.1.js"></script>

Usage

If not informed, $.QueryString will get the browser's address bar URL. To inform a different one, check the options parameters.

    // Return null if there is no query string
    $.QueryString();

    // Return the length of query strings
    $.QueryString().size;

    // Return null is the query string doesn't exist or the value of the
    // query string if it exists
    $.QueryString( //string );

    // Get the length of query strings with the same name
    $.QueryString( //string ).length;

    // Return que value of a query string modifying the URL, the choosing
    // its index and turning on or off the case sensitivity
    $.QueryString( //string, { // options
    	href : // URL string,
		index : // number,
		isCaseSensitive : boolean
    });

    // Get the value of a query string as an object
    $.QueryString().objectName;

The options paremeters and its values are

href

(string)(optional) URL with or without query strings where the query string wanted will be searched. Default: window.location

index

(number)(optional) It returns the value of a query string in a collection of query strings with same name. Default: null

isCaseSensitive

(boolean)(optional) Decides if the query string searched will have the case sensitivity considered. Default: true

License

Copyright (c) 2015 Darlesson Oliveira. Licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published