用js取url参数来做ajax

Request = {
query : function(name) {
var q = document.location.search.match(new RegExp("[\?\&]" + name
+ "=([^\&]*)(\&?)", "i"));
q = q ? q[1] : q;
 
if (q != null && q.trim().length == 0)
q = null;
 
return q;
}
}
posted @ 2017-06-15 22:19  developer_os  阅读(345)  评论(0编辑  收藏  举报