JS get behind the URL parameter method

In the project, you need to obtain a jump back URL path parameters, such as: www.url productId = 32.com business logic implemented according to the acquired the productId?
Function the getQueryString (name) {
   
 var new new REG = the RegExp ( "(^ | & ) "+ name +" = ([^ &] *) (& | $) "," I ");
   
 var = decodeURIComponent Search (the window.location.search);
   
 var R & lt search.substr = (. 1) .match ( REG);
    
   ! IF (R & lt = null) return unescape (R & lt [2]);
 
   return null;

}

Guess you like

Origin blog.csdn.net/weixin_41760500/article/details/82964152