Home > Article > Web Front-end > How to get the Get parameters in Url
This time I will show you how to get the Get parameters in Url, and what are the precautions for getting the Get parameters in Url. The following is a practical case, let's take a look.
At this time, you can use js to get the get parameters in the URL of the current page. The core statement is:window.location.hrefThe detailed code will not be explained, there are
Comments, you will understand after reading it. It is packaged into a jQuery expansion package.
(function($){ $.extend({ /** * url get parameters * @public * @ return array() */ urlGet:function() { var aQuery = window.location.href.split("?");//取得Get参数 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("=");//分离key与Value aGET[aTmp[0]] = aTmp[1]; } } return aGET; }, }); })(jQuery);I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:
jquery js gets focus control image
jquery operation animation display and hiding effect
Detailed explanation of jquery switching tabs method
The above is the detailed content of How to get the Get parameters in Url. For more information, please follow other related articles on the PHP Chinese website!