When processing Javascript on the frontend only, you may encounter a problem of passing a webpage parameter to the next page through the get method. In this case, you can obtain the Get parameter in the Url, as shown below, if you need it, you may encounter the problem of passing a webpage parameter to the next page by referring to the pure foreground processing of js.
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.
The Code is as follows:
(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 {
Var aTmp = aBuf [I]. split ("="); // separate the key and Value
AGET [aTmp [0] = aTmp [1];
}
}
Return aGET;
},
});
}) (JQuery );