Home  >  Article  >  Web Front-end  >  How to implement Javascript Request to obtain request parameters_javascript skills

How to implement Javascript Request to obtain request parameters_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:47:481635browse
复制代码 代码如下:

String.prototype.getParameter = function (key) {
var re = new RegExp(key '=([^&]*)(?:&)?');
return this.match(re) && this.match(re)[1];
};

测试代码:
复制代码 代码如下:



输出:
0
1
2
3
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn