Home >Web Front-end >JS Tutorial >Get the parameters behind the request

Get the parameters behind the request

巴扎黑
巴扎黑Original
2016-11-25 14:35:051132browse

function getSearchObj() { var url = getSearch(); var searchObj = {}; if (url) { // 去掉?号 url = url.substr(1); if (url.length > 0) { var arr = url.split("&"); for (var i = 0; i  0 && keyVal.indexOf("=") > 0) { var keyValArr = keyVal.split("="); var key = keyValArr[0]; var val = keyValArr[1]; searchObj[key] = val; } } } } return searchObj; } 

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
Previous article:jquery gets loop tag copyNext article:jquery gets loop tag copy