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

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