Small Example of jQuery getting url get parameter values

Source: Internet
Author: User

Copy codeThe Code is as follows: // * jQuery url get parameters function [get url get parameter value]
// * Character_set UTF-8
// * Author Jerry. li (lijian@dzs.mobi)
// * Version 1.2012.12.11.1400
// * Example
// * <Code>
// * Var GET = $. urlGet (); // Get the URL's GET Parameter
// * Var id = GET ['id']; // obtain the id value
// * </Code>
(Function ($)
{
$. Extend (
{
//
// Url get parameters
// Public
// Return array ()
//
UrlGet: function ()
{
Var aQuery = window. location. href. split ("? "); // Get the Get Parameter
Var aGET = new Array ();
If (aQuery. length> 1)
{
Var aBuf = aQuery [1]. split ("&");
For (var I = 0, iLoop = aBuf. length; I <iLoop; I ++)
{
Var aTmp = aBuf [I]. split ("="); // separate the key and Value
AGET [aTmp [0] = aTmp [1];
}
}
Return aGET;
},
});
}) (JQuery );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.