获取请求后面参数

代码哥0 2016-08-15

functiongetSearchObj(){varurl=getSearch();varsearchObj={};if(url){//去掉?号url=url.substr(1);if(url.length>0){vararr=url.split("&");for(vari=0;i0&&keyVal.indexOf("=")>0){varkeyValArr=keyVal.split("=");varkey=keyValArr[0];varval=keyValArr[1];searchObj[key]=val;}}}}returnsearchObj;}

相关推荐