首页 > 其他 > 详细

获取地址栏参数(E积分项目)

时间:2018-03-28 21:45:09      阅读:241      评论:0      收藏:0      [点我收藏+]
//地址栏获取参数
function getQueryString(name) {
  var search = document.location.hash;
  var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
  var matcher = pattern.exec(search);
  var items = null;
  if (null != matcher) {
    try {
      items = decodeURIComponent(decodeURIComponent(matcher[1]));
    } catch (e) {
      try {
        items = decodeURIComponent(matcher[1]);
      } catch (e) {
        items = matcher[1];
      }
    }
  }
  return items;
}

传的时候:

$(function() {
    $(".Jump").click(function(){
			window.location.href=‘http://10.133.254.129:9000/#/card-search-result?result=123456‘
		});
	})

  

取的时候  let result = getQueryString(‘result‘);

获取地址栏参数(E积分项目)

原文:https://www.cnblogs.com/ourLifes/p/8666140.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!