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

//地址栏获取参数
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');

posted @ 2018-03-28 20:40  南夏啊南夏  阅读(188)  评论(0编辑  收藏  举报