When processing Javascript on the frontend only, you may encounter the problem of passing a webpage parameter to the next page through the get method.
In this case, you can use js to obtain the get parameter in the url of the current page. The core statement is:
Window. location. href
The detailed code is not explained. If there is a comment, you can understand it. It is encapsulated into a jQuery extension package.
/**
* 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 );