For example, your URL is:
Http://www.jb51.net/index.php? Test = 1 & kk = 2
If you want to obtain test, you can introduce the plug-in,
Obtain it using the following method:
Var test = $. query. get ('test ');
If multiple parameters have the same name, you can do this:
Var arr = $. query. get ('testy ');
Output: [value 1, value 2, value 3...]
To obtain one of multiple identical names, you can:
Var arrayElement = $. query. get ('testy [1] ');
This plug-in can not only obtain parameters, but also set parameters.
Set a parameter:
Var newUrl = $. query. set ("section", 5). toString ();
Output :"? Section = 5"
Set two parameters:
Var newUrl = $. query. set ("section", 5). set ("action", "do"). toString ();
Output :"? Action = do § ion = 5"
Delete a parameter:
Var oldQueryAgain = $. query. REMOVE ("type ");
Clear all parameters:
Var emptyQuery = $. query. empty ();
Copy all parameters:
Var stillTheSame = $. query. copy ();
Plug-in address:
Http://plugins.jquery.com/project/query-object
Javascript [js] Code for obtaining url parameters
The JavaScript URL parameter is read from the simplified version.