Format/Structure:
Get:
var value = $.query.get( [Query String Parameter Name] );
Set:
var url = $.query.set( [Parameter Name] , [Parameter Value] );
Remove:
var result = $.query.REMOVE ( [Parameter Name] );
Examples:
Getting a query string parameter:
var id = $.query.get('id');
Setting a query string parameter:
var queryString = $.query.set('id',1);
Removing a query string parameter:
var results = $.query.REMOVE('id');
This plugin also contains the ability to customize a set of parameters to your liking.
Customization parameters:
- separator
- The default value for this setting is "&" as that is the standard for parameter separation.
- space
- The default value for this is true as most people prefer plus signs in query strings to be converted to spaces
- suffix
- The default for this is true. If set to true, any arrays, when outputted to a query string will be suffixed with "[]" to show them as an array more clearly.
- hash
- The default for this is false. If set to true, the output of a query string will be prefixed by a hash "#" rather than a question mark.
- prefix
- The default for this is true. If set to false, the output of a query string is NOT prefixed by a hash or question mark.
- numbers
- The default for this is true. If set to false, numbers in query strings will NOT be parsed.
View more information about this plugin here: JQuery.query
Download this plugin here: Download Page
No comments:
Post a Comment